MIT SIPB Script Services for Athena

How can I import an outside Django project?

Configuring an outside Django project to run on scripts can be a bit tricky if you’ve only before had experience with “./ runserver”. Here’s one way to get a Django project running on

  1. Start with the regular scripts Django autoinstaller
  2. Move the created /mit/lockername/Scripts/django/projname aside to /mit/lockername/Scripts/django/
  3. Copy in your application’s code to /mit/lockername/Scripts/django/projname
  4. Update the paths in /mit/lockername/web_scripts/progname/index.fcgi
    1. Make sure that the sys.path.insert line points to the directory containing projname (likely /mit/lockername/Scripts/django/)
    2. Possibly add a sys.path.insert line that points to /mit/lockername/Scripts/django/projname, if your includes are appname.models, not projname.appname.models (or similar)
    3. Make sure the chdir line is right —- it should point to the directory containing your project code
  5. Add a symbolic link from /mit/lockername/web_scripts/projname/media/ to /mit/lockername/Scripts/django/projname/media/
  6. Merge the autoinstalled (that is, /mit/lockername/Scripts/django/ into your
    1. Copy the database information
    2. Copy the SECRET_KEY, or make your own new one
    3. Copy the ADMIN_MEDIA_PREFIX —- for, this should be “/__scripts/django/static/admin/”
    4. Make sure the value of MEDIA_URL is reasonable (generally “/projname/media/”)
  7. Make sure to install any necessary dependencies (see How can I install Python modules in my locker? for instructions how to do so with easy_install)
  8. Set up your database appropriately, either by running “./ syncdb” or by installing a database dump from a running copy of your project
  9. Once you’ve confirmed that your Django project works, delete /mit/lockername/Scripts/django/

© 2004-2017, the SIPB project.
These pages may be reused under either the GFDL 1.2 or CC-BY-SA 3.0.
Questions? Contact

You are currently connected to