Run Django `manage.py makemigrations` without a database
All notes in this series:
- Run Django `manage.py makemigrations` without a database
- Using a non-pk as a foreign key in a Tastypie endpoint
- Run Django makemigrations as tox task
- Migrating from Tastypie to Django REST Framework
- Decimal error when upgrading from Django 3.1 to Django 3.2
- Normalizing a Django model
The makemigrations
command does not require a database to be present. As such, it is actually quite straightforward to run makemigrations
without even having a database. This can be very useful for the development cycle of: modifying model, run tests, update tests; without having to have a full deployment.
To run makemigrations
when you don’t even have a manage.py
, you can do the following. Assuming you are in the virtual environment with your Python package installed:
This will then create the new migration inside your Python package within the site-packages
folder in your virtual environment.