0

I have a Django project that runs well locally, but I cannot get it to work on my server.

I have all the necessary tables in my database, by running ".tables" in dbshell I can see the following:

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

However, when I try running the project in the browser I keep getting missing table errors:

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']

EDIT Settings:

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',
)

Error after deleting smartrec and running 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
Jon
  • 3,174
  • 11
  • 39
  • 57
  • You have your project locally and on server, right? You check your tables by `sqlite> .tables` locally? Have you made `python manage.py suncdb` on your server? Have you run `sqlite> .tables` on your server? – stalk Oct 10 '14 at 08:32
  • Yes I have ran syncdb and get the error "django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: jobs" – Jon Oct 10 '14 at 08:33
  • So, the main problem is `"django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: jobs"`, and not the one, that you've posted. So, describe the real reason. – stalk Oct 10 '14 at 08:36
  • Well I would say there are a number of issues here. The "real" reason is that I cannot load the url specified and can't run the sync as you asked. I am not sure about either. – Jon Oct 10 '14 at 08:37
  • provide contents of your `settings.INSTALLED_APPS`, `settings.DATABASES` – stalk Oct 10 '14 at 08:39
  • 1
    Check, is there a `smartrec` file (sqlite database) in your project folder on server. If it exists, delete it (probably make a copy to keep information if it matters) and run `syncdb` – stalk Oct 10 '14 at 08:46
  • It looked to be working until it ended with the same error - see edits – Jon Oct 10 '14 at 08:52
  • Maybe [this](http://stackoverflow.com/a/25643870/821594) will help – stalk Oct 10 '14 at 08:54
  • Thanks, any idea why I need an "apps.py" file? I don't have one currently. – Jon Oct 10 '14 at 09:10

0 Answers0