import os, sys, site from os.path import dirname, abspath os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") # Fix markdown.py (and potentially others) using stdout sys.stdout = sys.stderr SERVER_ROOT = abspath(dirname(dirname(__file__)))+'/' # Tell wsgi to add the Python site-packages to it's path. site.addsitedir(SERVER_ROOT+'venv/lib/python3.6/site-packages') sys.path = [SERVER_ROOT,] + sys.path sys.path.insert(0, os.path.join(SERVER_ROOT, "apps")) sys.path.insert(0, os.path.join(SERVER_ROOT, "apps/lib")) sys.path.insert(0, os.path.join(SERVER_ROOT, "config")) from django.core.wsgi import get_wsgi_application application = get_wsgi_application()