Skip to main content

Posts

Showing posts from July, 2018

Serving a Django 1.11 Application Through Apache and mod_wsgi

Create a django project "mysite" In "mysite" project we're going to change it a bit and add an apache directory which contain three files: In "mysite" add apache folder structure mysite/ manage.py mysite/ __init__.py settings.py urls.py apache/ __init__.py override.py wsgi.py myapp/ models.py views.py The empty __init__.py file tells Python to treat the directory as a package. Add following content in override.py # override.py from mysite.settings import * DEBUG = True ALLOWED_HOSTS = ['www.mydomain.com', 'mydomain.com'] Add following content in wsgi.py #wsgi.py 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(project) os.environ[...