简体   繁体   中英

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?

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",
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM