Django: python manage.py syncdb hangs forever

1.7k Views Asked by At

Output looks like this (the project is named parkingtickets):

usr/local/webapps/parkingtickets/django_project$ python manage.py syncdb
Creating tables ...
Creating table parkingtickets_correction

It then hangs forever. If I suspend the process and kill it, it does not die; I have to use kill -9. I've never encountered this before - as of this morning my app was running smoothly. I last ran syncdb successfully 3 days ago. At that time I had correction defined, and it worked fine. I modified the model to include a new field - a noneditable foreign key which was allowed to be null - dropped the table, and hit syncdb. Now this. I am happy to post any information people deem necessary. Relevant settings.py (CRUD is an internal framework we developed that mostly loads generic templates for us):

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 + '/'

EDIT: Ok, so that new foreign key I added causes the issue. A foreign key to any other table works fine, and modifications to the foreign key don't change anything (e.g. moving it up and down so it's parsed at a different time, making it editable, making it not accept nulls). Here is the definition of the table I want to foreign key into, 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)
0

There are 0 best solutions below