Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Web interface

jpmckinney edited this page Dec 17, 2012 · 4 revisions

In all instructions below, replace APPNAME with your Django app's name.

mkdir site
cd site
django-admin.py startproject APPNAME_site
mv APPNAME_site/manage.py .

manage.py

Replace its contents with:

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oglocal_site.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

settings.py

Add import os and set:

  • TIME_ZONE to 'UTC'
  • USE_L10N to False

Add:

USE_TZ = True
DATE_FORMAT = 'Y-m-d'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'Y-m-d H:i:s'
WSGI_APPLICATION = 'web.wsgi.application'

Add the following to TEMPLATE_DIRS:

    os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'templates')),

Add the following to INSTALLED_APPS:

    'django.contrib.humanize',
    'django.contrib.admin',
    'billy.web.api',
    'billy.web.admin',
    'billy.web.public',

Boundary service

If you are using the boundary service, set:

  • database ENGINE to 'django.contrib.gis.db.backends.postgis'
  • database NAME to APPNAME

and add the following to INSTALLED_APPS:

    'django.contrib.gis',
    'south',
    'boundaries',

If using Homebrew on Mac OS X, you may need to set the database HOST to 'localhost'

Otherwise, set:

  • database ENGINE to 'django.db.backends.sqlite3'
  • database NAME to os.path.join(os.path.dirname(__file__), 'APPNAME.sqlite3')

urls.py

Uncomment:

from django.contrib import admin
admin.autodiscover()

Add the following to urlpatterns:

    (r'^api/', include('billy.web.api.urls')),
    (r'^admin/', include('billy.web.admin.urls')),
    (r'^djadmin/', include(admin.site.urls)),
    (r'^', include('billy.web.public.urls')),

Boundary service

If you are using the boundary service, add the following to urlpatterns:

    (r'', include('boundaries.urls')),

wsgi.py

Create a wsgi.py file under site/APPNAME_site

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Next steps

python site/manage.py runserver