python - django migration table does not exist -


i have added new model app. did makemigration , in migration can see code create models like:

operations = [     migrations.createmodel(         name='blog',         fields=[             ('id', models.autofield(verbose_name='id', serialize=false, auto_created=true, primary_key=true)),             ('title', models.charfield(max_length=120)),             ('body', models.textfield()),             ('post_date', models.datetimefield(default=django.utils.timezone.now)),             ('like', models.integerfield(default=0)),             ('created_by', models.foreignkey(to=settings.auth_user_model)),         ],         options={         },         bases=(models.model,), 

now when python manage.py migrate gives me error saying table not exist..

why getting error. should have been migrated right ? how fix issue?

  1. drop tables,
  2. comment-out model in model.py,
  3. if using django version >= 1.7:

python manage.py makemigrations

python manage.py migrate --fake

else

python manage.py schemamigration someapp --auto

python manage.py migrate someapp --fake

  1. comment-in model in models.py
  2. go step 3. but time without --fake

reference: https://stackoverflow.com/a/27583836/4359237


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -