Skip to content

Instantly share code, notes, and snippets.

@hassek
Created July 19, 2012 05:30
Show Gist options
  • Save hassek/3140964 to your computer and use it in GitHub Desktop.
Save hassek/3140964 to your computer and use it in GitHub Desktop.
"""
WSGI config for fitvaina project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
import site
import sys
lazy_path = lambda p1, p2: os.path.abspath(os.path.join(p1, p2))
# Dynamically resolve paths.
VIRTUALENV_PATH = '/Users/Tommy/.virtualenvs'
SITE_PACKAGES_PATH = lazy_path(VIRTUALENV_PATH,
'fitnerd/lib/python2.7/site-packages')
WORKING_PATH = os.path.abspath(os.path.dirname(__file__))
ROOT_PATH = lazy_path(WORKING_PATH, '../')
site.addsitedir(SITE_PACKAGES_PATH)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fitvaina.settings")
# check virtualenv site-packages FIRST! before the fucking Jacuzzi!
sys.path.insert(0, SITE_PACKAGES_PATH)
sys.path.append(ROOT_PATH)
sys.path.append(lazy_path(ROOT_PATH, 'fitnerd'))
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment