Skip to content

Instantly share code, notes, and snippets.

@drawcode
Last active December 11, 2015 12:19
Show Gist options
  • Select an option

  • Save drawcode/4600159 to your computer and use it in GitHub Desktop.

Select an option

Save drawcode/4600159 to your computer and use it in GitHub Desktop.
django apache mod_wsgi config
<VirtualHost *:80>
DocumentRoot D:/http/mysite-com
WSGIScriptAlias / D:/http/mysite-com/apache/django.wsgi
ServerName mysite.com
</VirtualHost>
import os, sys
#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
sys.path.append('D:/django-sites')
sys.path.append(['D:/django-sites'] + sys.path)
sys.path.append('D:/django-sites/mysite_com')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite_com.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
import os, sys
#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
site = 'mysite'
site_code = site + '_com'
site_path = 'E:/http/django-sites'
sys.path.append(workspace)
sys.path.append(site_path)
sys.path.append([site_path] + sys.path)
sys.path.append(site_path + site_code )
os.environ['DJANGO_SETTINGS_MODULE'] = site_code + '.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment