Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: python manage.py migrate does nothing at all

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?

like image 821
Adam Karolczak Avatar asked May 01 '17 11:05

Adam Karolczak


People also ask

Why python manage py migrate is not working?

“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.

How do I fix migration issues in Django?

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.

What does Django manage py migrate do?

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.

Does Django handle migrations?

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 .


2 Answers

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.

like image 164
Pierre Monico Avatar answered Sep 23 '22 12:09

Pierre Monico


Try:

python manage.py makemigrations
python manage.py migrate
like image 31
Amiral Jion Avatar answered Sep 25 '22 12:09

Amiral Jion