简体   繁体   中英

Why is a syncdb not populating models.py models?

I have, in models.py:

class Flashcard(models.Model):
    english = models.TextField()
    slavonic = models.TextField()

urls.py references models.py in an attempt to make python manage.py syncdb pick up on models.py:

import models

However, a python manage.py syncdb does not result in the creation of a *_flashcards table:

$ python manage.py syncdb && sqlite3 flashcards.db 
No fixtures found.
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
auth_group                  auth_user_user_permissions
auth_group_permissions      django_admin_log          
auth_message                django_content_type       
auth_permission             django_session            
auth_user                   django_site               
auth_user_groups          
sqlite> 

What should I be doing differently to get a flashcards_flashcards table? The admin interface picks up on it perfectly, up to displaying an "Add entry" page for the model.

Thanks,

你忘了你的应用添加到INSTALLED_APPS设置文件,这就是为什么syncdb命令不选择在该应用中定义的模型。

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