Zags
Zags

Reputation: 41220

Django manage.py syncdb not creating models

I have a django project, I have configured the database settings in settings.py, and I have created database models in a file. What else do I need to do for manage.py syncdb to create the corresponding tables in my database?

Upvotes: 0

Views: 206

Answers (1)

Zags
Zags

Reputation: 41220

There are two more steps. First, database models must be in a file called models.py. Other files aren't recognized by django for database models. Second, you need to add an entry to INSTALLED_APPS inside settings.py for the module containing this models.py. So, if you have in your project somedir/models.py, you need to have in your settings.py:

INSTALLED_APPS = (
    #...
    "somedir",
)

Upvotes: 1

Related Questions