Skip to content

Instantly share code, notes, and snippets.

@ahmadalsajid
Last active May 30, 2019 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmadalsajid/894bdb275f11a83e4a39705b5293c721 to your computer and use it in GitHub Desktop.
Save ahmadalsajid/894bdb275f11a83e4a39705b5293c721 to your computer and use it in GitHub Desktop.
mod_wsgi with apache to serve Django application on windows server
import os
import sys
import site
from django.core.wsgi import get_wsgi_application
# add python site packages, you can use virtualenvs also
site.addsitedir("C:/Program files/python36/Lib/site-packages")
# Add the app's directory to the PYTHONPATH
sys.path.append('C:/Users/Administrator/Desktop/my_project')
sys.path.append('C:/Users/Administrator/Desktop/my_project/my_project')
os.environ['DJANGO_SETTINGS_MODULE'] = 'my_project.settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_project.settings")
application = get_wsgi_application()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment