Django:' python manage.py syncdb'不会创建我的架构表

时间:2014-11-16 00:24:21

标签: python django database sqlite web

这是我的models.py

# coding: utf-8
from django.db import models

class P(models.Model):
    n = models.CharField(max_length=255)

class I(models.Model):
    t = models.CharField(max_length=255)
    p = models.ForeignKey(P)

这是命令行:

rm db.sqlite3 
$ python manage.py syncdb
Operations to perform:
  Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying sessions.0001_initial... OK

You have installed Django's auth system, and don't have any superusers defined.
Would you like to create one now? (yes/no): no

它假装它已经完成了所有操作,但我没有在DB中看到表,我的代码也没有

1 个答案:

答案 0 :(得分:1)

确保您的应用列在项目设置文件中的INSTALLED_APPS

INSTALLED_APPS = (
    ...,
    'your_app',
)