1

I'm building a Django app from an existing database. The existing database is all set up and working as I need it to.

The models for this existing project were automatically placed in my project directory.

Here is a rough idea of the relevant directories:

    myProject
    | manage.py
    | myProject
    |  | models.py   <- auto generated models were placed here (also new models here)
    | app1
    |  | models.py
    |  | migrations

I figured my new models would be accessed by all apps I install, so I've included some more models in the same models.py as the auto generated one.

Running makemigrations does not seem to pick up any changes I've made. (I've even included 'myProject' in installed apps)

How do I migrate these changes?

Arpit Solanki
  • 9,567
  • 3
  • 41
  • 57
Shuntley
  • 13
  • 4

2 Answers2

0

You have to add a __init__.py to your migrations folder to make new migrations.__init__.py makes your migrations folder a module thus it can be identified by Django for new migrations.

Arpit Solanki
  • 9,567
  • 3
  • 41
  • 57
0

This is an old question, but just for completion's sake: As answered in Django project models.py versus app models.py and Django - makemigrations - No changes detected, you should not put your models in your project app. They should be scattered across your apps, where you are using them.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30551910) – Flair Dec 11 '21 at 02:20