Setting up Agiliq's version of the EMS - Roadblocks and Solutions.

Python Path Issues.

  1. Cloned the repository from Agiliq's Github profile.
  2. Setup Apache with mod_wsgi with appropriate environment variables via SetEnv. Gives - ImproperlyConfigured: Error importing middleware fullhistory.fullhistory: "cannot import name simplejson
  3. FIX - Python Path was wrong in the wsgi file.
  4. FIX - Python Path setting in the virtual host file in /etc/apache/site-available/ was wrong. Changed path for DJANGO_SETTINGS_MODULE since it was now relative to the new path.
  5. Did a backup of the old wsgi files, nevertheless.

Database mismatches.

  1. When tried logging in with our login credentials, the application throws another error (See Attachment.) - TypeError at /login/ 'NoneType' abject as no attribute '__getitem__'
  2. CAUSE: Django User missing. Tried creating a superuser using the Django admin

python shell from django.contrib.auth.models import User user = User.objects.create(username='super_user') user.set_password('super_password')

  1. Error remains :
  2. Performed a syncdb -

python syncdb

  1. sqldiff showed some differences between db state and models file, but nothing significant.
  2. Imported Agiliq's database dump.
  3. Confirmed the pip packages as per Agiliq's environment - ``` Django==1.5.1 Unipath==1.0 argparse==1.2.1 django-crispy-forms==1.4.0 django-debug-toolbar==1.2.1 django-extensions==1.2.0 gunicorn==19.0.0 psycopg2==2.5.1 simplejson==3.3.0 six==1.7.2 sqlparse==0.1.11 wsgiref==0.1.2


  1. Most of it was missing from the requirements.txt file. Updated requirements.txt.
  2. Swapped the database by setting the environment variable in virtualhost file.
  3. New problem - ImproperlyConfigured at /login/ 'The included urlconf klpmis.urls doesn't have any patterns in it'
  4. The Django development server continues to work.


  1. Eventually found some typos in the settings directory - ``` this from -from .local_settings import * +from local_settings import *

this from -from . base import +from base import ```

  1. Added STATIC_ROOT = Path(PROJECT_ROOT, 'collected_static') and changed Apache Alias accordingly to: Alias /static_media /home/klp/KLP-MIS/klpmis/collected_static in the virtual host.
  2. Issues resolved temporarily.

Django Debug Toolbar

  1. After a while, error persists - ImproperlyConfigured at /login/ 'The included urlconf klpmis.urls doesn't have any patterns in it'
  3. Moved the production settings to Switched this in the Apache virtualhost.


  1. 500 error. Debug email suggested missing ALLOWED_HOSTS.
  2. FIX: Added ALLOWED_HOSTS = '*' in

The settings has to undergo major changes accordingly and we need to make sure it works all fine for production. Testing of the application estimated to complete within one week.

Last modified 4 years ago Last modified on 06/25/14 17:47:31

Attachments (1)

Download all attachments as: .zip