Skip to content

How do I create a migration when creating a Django app? #817

Answered by browniebroke
abe-101 asked this question in Q&A
Discussion options

You must be logged in to vote

Great question. I've had this issue while trying to contribute to reusable Django apps, it's a real problem.

I thought the answer would be simpler, but while trying it out, I found several issues with the current setup. Basically, you need to:

  • Add a manage.py at the root of your project. This can be taken from the standard django-admin startproject and pointing the default setting file to the test settings: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") at the beginning of main() function
  • Create a migrations/__init__.py in your app
  • Run python manage.py makemigrations --skip-checks and you should see your new migration file. The --skip-checks is required because the def…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@browniebroke
Comment options

@abe-101
Comment options

Answer selected by abe-101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants