1
votes

I am trying to learn Django by setting up one of the projects I found on github. Afetr I ran the syncdb command it showed Not synced (use migrations): - django_extensions - djangoratings - profiles - guardian (use ./manage.py migrate to migrate these).

When I am running "python manage.py migrate app" , it gives AttributeError: 'module' object has no attribute 'Migration'.

I also ran schemamigration app --auto and --initial as well. But nothing seems to be working. Can somebody point out where I am going wrong.

2
If you are just starting, then delete your migrations directory, and run your schemamigration --initial, then syncdb.Zack Argyle
@ZackArgyle , When I ran---->python manage.py schemamigration profiles --initial Creating migrations directory at '\profiles\migrations'... Creating init.py in '\profiles\migrations'... + Added model profiles.Project + Added model profiles.UserProfile + Added model profiles.SavedResource + Added unique constraint for ['user', 'resource'] on profiles.SavedResource + Added model profiles.TopicFollow + Added unique constraint for ['user', 'topic'] on profiles.TopicFollow Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate profilesuser2900150
@ZackArgyle: But the next command gives the same error, When I ran ----->python manage.py migrate profil es AttributeError: 'module' object has no attribute 'Migration'user2900150
syncdb before you migrate, after schemamigration --initialZack Argyle
@ZackArgyle: of course I did that :)user2900150

2 Answers

0
votes

Are you actually running python manage.py migrate app exactly? If you want to migrate all apps, just run python manage.py migrate. (without app) If there is an app actually named app that you want to run migrations for, then you would do what you did.

If you still get the error after running python manage.py migrate, then there must be an invalid migration file somewhere. I would migrate each app individually like this:

python manage.py migrate django_extensions
python manage.py migrate djangoratings
... etc.

to find the app with bad a migration file. Once you find the app, look in the migrations folder of the app to find any empty migration files.

0
votes

First thing you must run initial migration.

python manage.py schemamigration --initial

You are getting this error because of your project structure or there is some issue with your south package .try to remove and reinstalling south.
You need to see that there should not be any extra .py file in your migration folder.