Django: python manage.py migrate does nothing at all
Question:
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?
Answers:
Try:
python manage.py makemigrations
python manage.py migrate
Have you tried with parameter?
python manage.py makemigrations <app_name>
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.
@adam-karolczak n all
If there are multiple DJANGO Projects, it can happen that DJANGO_SETTINGS_MODULE is set to some other app in environment varibles, the current project manage.py will not point to current project settings thus the error.
So, confirm DJANGO_SETTINGS_MODULE in fact points to the settings.py of current project.
Close the project if its running viz. ctrl+C.
You can also check the server is not running ( linux ) by
ps -ef | grep runserver
Then kill the process ids if they exist.
If you confirmed settings.py in DJANGO_MODULE_SETTINGS is for the project you are having issue.
Run the following it should resolve.
python manage.py makemigrations
python manage.py migrate
Hope it helps.
I was getting the same error
running this 2 command in terminal
python manage.py makemigrations
python manage.py migrate
and then
python manage.py runserver
solved my issues.
Thanks
I had the same issue and the problem was that there was a pg_dump script running at the same time I was trying to migrate. After the dump was completed, migrations ran successfully.
-
Check that INSTALL_APPS app exists, if not add it
-
Checks the model for default attributes
-
Running this 2 command in terminal
python manage.py makemigrations
python manage.py migration
- First exit of the present web server by typing
Ctrl + C
- Then run
python manage.py migrate
The Warning is due to not configuring the initial database or migrating.
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?
Try:
python manage.py makemigrations
python manage.py migrate
Have you tried with parameter?
python manage.py makemigrations <app_name>
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.
@adam-karolczak n all
If there are multiple DJANGO Projects, it can happen that DJANGO_SETTINGS_MODULE is set to some other app in environment varibles, the current project manage.py will not point to current project settings thus the error.
So, confirm DJANGO_SETTINGS_MODULE in fact points to the settings.py of current project.
Close the project if its running viz. ctrl+C.
You can also check the server is not running ( linux ) by
ps -ef | grep runserver
Then kill the process ids if they exist.
If you confirmed settings.py in DJANGO_MODULE_SETTINGS is for the project you are having issue.
Run the following it should resolve.
python manage.py makemigrations
python manage.py migrate
Hope it helps.
I was getting the same error
running this 2 command in terminal
python manage.py makemigrations
python manage.py migrate
and then
python manage.py runserver
solved my issues.
Thanks
I had the same issue and the problem was that there was a pg_dump script running at the same time I was trying to migrate. After the dump was completed, migrations ran successfully.
-
Check that INSTALL_APPS app exists, if not add it
-
Checks the model for default attributes
-
Running this 2 command in terminal
python manage.py makemigrations
python manage.py migration
- First exit of the present web server by typing
Ctrl + C
- Then run
python manage.py migrate
The Warning is due to not configuring the initial database or migrating.