I just started learning django, and as i try to apply my migrations the first problem occurs. I start the server up, type
python manage.py migrate
and nothing happens. No error, no crash, just no response.
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
May 01, 2017 - 11:36:27
Django version 1.11, using settings 'website.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
python manage.py migrate
And that's the end of my terminal feed. I thought maybe it just looks like nothing happens, but no. The changes weren't applied and I can't proceed any further. Any ideas on what's going on?
“python manage.py migrate not working” Code Answer's In Database delete row 'profiles' from the table 'django_migrations'. Delete all migration files in migrations folder. Try again python manage.py makemigrations and python manage.py migrate command.
If dropping your database is not an option then the next best solution is to find the last working state of the database and then create new migration files. Find the last good state where your database was working. Delete all the files from the migrations folder. Uncomment the changes which you did in step 2.
migrate executes those SQL commands in the database file. So after executing migrate all the tables of your installed apps are created in your database file. You can confirm this by installing SQLite browser and opening db.
Django can't automatically generate data migrations for you, as it does with schema migrations, but it's not very hard to write them. Migration files in Django are made up of Operations, and the main operation you use for data migrations is RunPython .
Well, you say that you first start the server and then type in the commands. That's also what the terminal feed you shared shows.
Do not run the server if you want to run management commands using manage.py
.
Hit Ctrl+C to exit the server and then run your migration commands, it will work.
Try:
python manage.py makemigrations
python manage.py migrate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With