找不到Django DB

时间:2014-10-10 08:20:45

标签: django sqlite django-models django-1.7

我有一个在本地运行良好的Django项目,但我无法让它在我的服务器上运行。

我在数据库中拥有所有必需的表,通过在dbshel​​l中运行“.tables”我可以看到以下内容:

sqlite> .tables
admin_tools_dashboard_preferences  jobs_applicant
admin_tools_menu_bookmark          jobs_education
auth_group                         jobs_employment
auth_group_permissions             jobs_job
auth_permission                    jobs_location
auth_user                          jobs_medical
auth_user_groups                   jobs_medicalpart2
auth_user_user_permissions         jobs_medicalpart3
django_admin_log                   jobs_medicaltop
django_content_type                jobs_previousemployment
django_migrations                  jobs_qualification
django_session                     jobs_referencedisclaimer
django_site                        jobs_registrant
filebaby_filebabyfile              jobs_sugaruser
fileuploads_fileupload             jobs_workingtimeregulations
jobs_alcoholsubstancemisuse        south_migrationhistory

但是,当我尝试在浏览器中运行项目时,我不断错过表错误:

OperationalError at /jobs/add/
no such table: jobs_registrant
Request Method: GET
Request URL:    https://10.8.1.143/jobs/add/
Django Version: 1.7
Exception Type: OperationalError
Exception Value:    
no such table: jobs_registrant
Exception Location: /opt/.virtualenvs/smart/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 485
Python Executable:  /usr/bin/python
Python Version: 2.7.6
Python Path:    
    ['/opt/Webapp',
     '/opt/.virtualenvs/smart/lib/python2.7/site-packages/django_admin_tools-0.5.1-py2.7.egg',
     '/opt/.virtualenvs/smart/lib/python27.zip',
     '/opt/.virtualenvs/smart/lib/python2.7',
     '/opt/.virtualenvs/smart/lib/python2.7/plat-linux2',
     '/opt/.virtualenvs/smart/lib/python2.7/lib-tk',
     '/opt/.virtualenvs/smart/lib/python2.7/lib-old',
     '/opt/.virtualenvs/smart/lib/python2.7/lib-dynload',
     '/usr/local/lib/python2.7',
     '/usr/local/lib/python2.7/plat-linux2',
     '/usr/local/lib/python2.7/lib-tk',
     '/opt/.virtualenvs/smart/lib/python2.7/site-packages']

修改 设定:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'smartrec',
    }
}
...
INSTALLED_APPS = (
    'fileuploads',
    'admin_tools',
    'admin_tools.menu',
    'admin_tools.dashboard',
    'admin_tools.theming',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'jobs',     #the jobs app
    'django_tables2',
)

删除smartrec并运行sncdb后出错

Operations to perform:
Synchronize unmigrated apps: fileuploads, jobs, menu, dashboard, admin_tools, theming,   django_tables2
Apply all migrations: jobs, sessions, admin, sites, auth, contenttypes
Synchronizing apps without migrations:
Creating tables...
    Creating table fileuploads_fileupload
    Creating table admin_tools_menu_bookmark
    Creating table admin_tools_dashboard_preferences
    Creating table jobs_location
    Creating table jobs_job
    Creating table jobs_registrant
    Creating table jobs_applicant
    Creating table jobs_sugaruser
Installing custom SQL...
Installing indexes...
Running migrations:
    Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying jobs.0001_initial...Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
   ...
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: jobs

0 个答案:

没有答案