I am learning Python web development. After installing Django and starting the server by running the comment python manage.py runserver in the integrated terminal. I got a message in red letters about unapplied migration(s) and the project may not work properly because of this.
$ python manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). You have 17 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. July 18, 2019 - 04:47:07 Django version 2.2.3, using settings 'web_project.settings' Starting development server at Quit the server with CONTROL-C.
To fix this issue, I tried running the comment python manage.py migrate in the same integrated terminal. But nothing happened. Then I realized that I have to stop the Django server before running the migration comment.
Solution for unapplied migration(s)
To run the migrate comment:
- First, stop the Django server by pressing the keys CONTROL-C.
- Then run the comment python manage.py migrate in the same integrated terminal or a new one. Now you can see all the required migrations applied to the apps.
Tools & Technologies Involved
- Python (3.7.3)
- Django (2.2.3)
- Visual Studio Code (1.36.0)
- macOS Mojave (10.14.5)
- About Django migrate comment at Django Docs.