输出看起来像这样(项目名为parkingtickets):
usr/local/webapps/parkingtickets/django_project$ python manage.py syncdb
Creating tables ...
Creating table parkingtickets_correction
然后永远挂起。如果我暂停这个过程并杀死它,它就不会死;我必须使用kill -9
。我以前从未遇到过这种情况 - 截至今天早上我的应用程序运行顺利。我上次成功运行了syncdb 3天前。那时我已经定义了修正,并且工作正常。我修改了模型以包含一个新字段 - 一个允许为空的不可编辑外键 - 删除表,然后点击syncdb。现在这个。我很乐意发布人们认为必要的任何信息。相关的settings.py(CRUD是我们开发的一个内部框架,主要为我们加载通用模板):
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
INTERNAL_IPS=('ADDRESS_OMITTED','ADDRESS_OMITTED')
MANAGERS = ADMINS
DATABASE_ENGINE = 'sql_server.pyodbc'
DATABASE_NAME = 'NAME_OMITTED'
DATABASE_USER = 'USER_OMITTED'
DATABASE_PASSWORD = 'PASS_OMITTED'
DATABASE_HOST = 'HOST_OMITTED'
DATABASE_PORT = '1433'
APPNAME = 'parkingtickets'
DATABASE_OPTIONS = {
'driver': 'FreeTDS',
'dsn': 'websiteredesign',
'timeout': 1,
'connect_timeout': 1,
'SQL_ATTR_LOGIN_TIMEOUT': 1}
TIME_ZONE = 'America/New_York'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
MEDIA_ROOT = '/var/www/site-media/'
MEDIA_URL = '/site-media/' + APPNAME
ADMIN_MEDIA_PREFIX = '/media/'
SECRET_KEY = SECRET_KEY_OMITTED
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
ROOT_URLCONF = 'django_project.urls'
TEMPLATE_DIRS = (
'/usr/local/webapps/' + APPNAME + '/django_templates/',
'/usr/local/webapps/crud/',
)
TEMPLATE_CONTEXT_PROCESSORS = ('crud.context_processors.settings',
'django.core.context_processors.auth',
'django.core.context_processors.media',
'django.core.context_processors.request')
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
APPNAME,
'crud',
'crud.crud_tags',
'django.contrib.admin',
'debug_toolbar',
)
LOGIN_URL = '/' + APPNAME + '/accounts/login/'
LOGIN_REDIRECT_URL = '/' + APPNAME + '/'
编辑:好的,所以我添加的新外键会导致问题。任何其他表的外键工作正常,对外键的修改不会改变任何东西(例如,上下移动它以便在不同时间解析它,使其可编辑,使其不接受空值)。这是我想要外键进入的表的定义,Ticket:
class Ticket(CrudModel):
_amount_due = models.DecimalField(decimal_places=2,max_digits=32,default=Decimal('0.00'),editable=False)
_amount_paid = models.DecimalField(decimal_places=2,max_digits=32,default=Decimal('0.00'),editable=False)
number = models.CharField(max_length=128,unique=True)
ticket_date = models.DateField()
time = models.TimeField()
plate_number = models.CharField(max_length=128)
plate_state = USStateField(default='CT')
make = models.ForeignKey(Make)
model = models.CharField(max_length=128)
color = models.ForeignKey(Color)
location = models.CharField(max_length=128)
officer = models.ForeignKey(Officer)
_class = models.ForeignKey(Class,null=True,blank=True,verbose_name='Class')
vin = models.CharField(max_length=128,blank=True)
towed_to = models.CharField(max_length=128,blank=True)
remarks = models.TextField(blank=True)
owner = models.ForeignKey(Owner,null=True,blank=True)
delinquency_letter = models.DateField(null=True,blank=True)