【问题标题】:Django: 'python manage.py syncdb' does not create my schema tablesDjango:'python manage.py syncdb' 没有创建我的模式表
【发布时间】:2015-01-13 04:00:12
【问题描述】:

这是我的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

它假装它已经完成了所有事情,但我没有看到数据库中的表,我的代码也没有

【问题讨论】:

    标签: python django database sqlite web


    【解决方案1】:

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

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

    【讨论】:

    • 不客气,你过去一年的进步非常好。真的很高兴有你在这里。
    猜你喜欢
    • 2014-06-07
    • 1970-01-01
    • 1970-01-01
    • 2012-05-27
    • 1970-01-01
    • 2011-08-04
    • 2014-09-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多