Django 1.7 Migrating with my old project

I have a django 1.5 application, now I have migrated it to django 1.7 and the application works fine with the old database. But now I want to create migrations for this application using django 1.7.

I removed old migrations and just kept the migration folders with __ init__ files

then i ran ./manage.py makemigrations

at startup ./manage.py migrate

, which gives some errors.

django.db.utils.ProgrammingError: relation "django_site" does not exist
LINE 1: SELECT (1) AS "a" FROM "django_site" LIMIT 1

      

I have added django_sites to my installed apps.

Is there any special way to create / apply migrations when upgrading to native migrations?

+3


source to share


2 answers


you have a migration that depends on django.contrib.site but the linked tables are not available. You can

  • move django.contrib.site to INSTALLED_APPS
  • check dependencies

    your migration attribute

Anyway, I think your problem is with the default value for some field.



If you don't find the application involved, you can:

  • disable all apps in INSTALLED_APPS
  • turn on the first
  • run makemigrations
  • remove all migrations
  • include the following app
  • run makemigrations ... repeat step 4..6 until you get an error.
+3


source


From the documentation :

If you already have prebuilt migrations generated with South, then the upgrade process to use django.db.migrations is pretty simple:

  • Make sure all installations are fully up to date with their migrations.
  • Remove "south" from INSTALLED_APPS.
  • Delete all your (numbered) migration files, but not the directory or init .py - make sure you delete the .pyc files as well.
  • Run python manage.py makemigrations. Django should see empty migration directories and create new initial migrations in the new format. Run python manage.py migrate. Django sees that the tables for the initial migrations already exist and marks them in use without running them.


I suspect you've forgotten

find . -iname "*.pyc" | xargs rm

      

0


source







All Articles