Django: python manage.py migrate does nothing
I just started learning django and when I try to apply my migrations the first problem comes up. I started the server, enter
python manage.py migrate
and nothing happens. No error, no glitches, 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. I thought maybe it just looks like nothing is happening, but no. The changes have not been applied and I cannot proceed. Any ideas on what's going on?
source to share
Okay, you say you start the server first and then enter the commands. It also shows what the final channel is showing.
Don't start the server if you want to run management commands with manage.py.
Press Ctrl + C to log out of the server and then run your migration commands, it will work.
source to share
@ adam-karolczak n all
If there are multiple DJANGO projects, it may happen that DJANGO_SETTINGS_MODULE is configured for some other application in environment variables, the current manage.py project will not point to the current project settings and therefore an error.
So, confirm that DJANGO_SETTINGS_MODULE is actually pointing to the settings.py file of the current project.
Close the project if it is running, namely. ctrl+ C. You can also check that the server is down (Linux),
ps -ef | grep runserver
Then kill the process ids if they exist. If you have confirmed that the settings.py in DJANGO_MODULE_SETTINGS refers to the project that has the problem. Run the following, this should resolve.
python manage.py makemigrations
python manage.py migrate
Hope it helps.
source to share