django-migrations

right way to create a django data migration that creates a group?

…衆ロ難τιáo~ 提交于 2020-01-14 10:25:41
问题 I would like to create data migrations that create Permissions and Groups, so that my other developers can just run the migrations and get everything set up. I was able to create the migrations and run them just fine, but now I'm getting an error when running my tests. But if I do this: from django.contrib.auth.models import Group def add_operations_group(apps, schema_editor): Group.objects.get_or_create(name='operations') I get: django.db.utils.OperationalError: no such table: auth_group If

django.db.utils.OperationalError: near “[]”: syntax error

喜你入骨 提交于 2020-01-14 10:06:44
问题 There is this error showing after I have used makemigrations command I have tried commenting different column for it but it wont work C:\Users\Rushabh\Desktop\project\MyPrj>python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, paper, sessions Running migrations: Applying paper.0014_auto_20170405_1549...Traceback (most recent call last): File "C:\Users\Rushabh\Anaconda3\lib\site-packages\django\db\backends\utils.py", line 62, in execute return self

django.db.utils.OperationalError: near “[]”: syntax error

让人想犯罪 __ 提交于 2020-01-14 10:03:02
问题 There is this error showing after I have used makemigrations command I have tried commenting different column for it but it wont work C:\Users\Rushabh\Desktop\project\MyPrj>python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, paper, sessions Running migrations: Applying paper.0014_auto_20170405_1549...Traceback (most recent call last): File "C:\Users\Rushabh\Anaconda3\lib\site-packages\django\db\backends\utils.py", line 62, in execute return self

Cannot get Django 1.7 Migrations to detect proper changes to my DB.

旧时模样 提交于 2020-01-14 04:59:06
问题 I have a production web project running with a decent amount of data in the MySQL db. I am trying to update the database with some changes to an app called "enterlink." I've made new elements in the existing models and created new models altogether. Before this migration, I have never touched the schema of the db since originally running syncdb to create it. When I run: "python manage.py makemigrations enterlink" the below output appears(pic). My question is, why is this happening? The DB

How to solve SQLdecode error when you migrate models in django?

拥有回忆 提交于 2020-01-13 06:49:53
问题 I am new to django, I have created a project and app and I would like to connect my project to the mongodb. when I enter python manage.py migrate command , I am getting below mentioned error. I have dropped database and cleared all migrations in the django_migration table and deleted migration files in the created migrations folder. Still getting same error. Please help me with this. Thanks in advance Error: raise TypeError("documents must be a non-empty list") TypeError: documents must be a

Unable to create the django_migrations table (ORA-02000: missing ALWAYS keyword)

隐身守侯 提交于 2020-01-11 05:54:42
问题 I'm starting a project in Django-2.0.1 with a database Oracle 11g, and when I run $python manage.py migrate, I get the error django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (ORA-02000: missing ALWAYS keyword). You can see the full stack below: Traceback (most recent call last): File "/Users/user/anaconda3/lib/python3.6/site-packages/django/db/backends/utils.py", line 83, in _execute return self.cursor.execute(sql) File "/Users/user

Why is Django on_delete rule not working?

狂风中的少年 提交于 2020-01-06 11:17:50
问题 I have two models connected via a ForeignKey sort of like this: class Album(models.Model): name = models.CharField(max_length=128) # ... class Track(models.Model): name = models.CharField(max_length=128) album = models.ForeignKey(Album, related_name='tracks', null=True, on_delete=models.SET_NULL) # ... I'm writing a data migration where I try to delete some Albums: # -*- coding: utf-8 -*- # Generated by Django 1.9.13 on 2018-12-12 14:05 from __future__ import unicode_literals from django.db

How can I set/provide a default value while django migration?

你。 提交于 2020-01-02 10:30:21
问题 Scenario : I have a model, Customer class Customer(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() company = models.CharField(max_length=100) and now I updated the company attribute witha ForeignKey relationship as below, class Company(models.Model): name = models.CharField(max_length=100) location = models.CharField(max_length=100) class Customer(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() company = models.ForeignKey

Django Migration Error - NodeNotFoundError

旧时模样 提交于 2020-01-02 04:06:32
问题 Django verstion 1.8 Trying to migrate a newly added app in my project. Here is the traceback error: Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 346, in execute self.fetch_command(subcommand).run_from

Django migrations fail in heroku

回眸只為那壹抹淺笑 提交于 2020-01-02 02:19:17
问题 I'm trying to deploy a Django (1.8) app to Heroku, runtime Python 3.4.2. The app runs succesfully (except the fact that tables are not created), but when trying run the syncdb I get the following error: Running `python manage.py syncdb` attached to terminal... up, run.5851 /app/.heroku/python/lib/python3.4/site-packages/django/core/management /commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9 warnings.warn("The syncdb command will be removed in