Reputation: 1380
I'm trying to set up 2 Django Projects within Apache using wsgi and I seem to be having trouble with the conf files for apache (which I know little about)
I have 2 projects ("MyTestProjOne" and "Project" - Naming I know :-/ )
If I restart the Apache Server and go to [servername]/Project
first, it will start. However once I go to [servername]/MyTestProjOne
it says can not match url to Project.urls
and it reverses.
All of these symptoms are due to a wsgi not running in daemon mode from what I've learned through google, however I dont' know how to fix it.
It is similar problem as this, however none of the solutions solved the issue as I can't run Daemon mode on a windows machine (from what I've been told). Deploying multiple django apps on Apache with mod_wsgi
my wsgi files are for project one ("MyTestProjOne") wsgi.py
:
import os, sys
sys.path.append('C:/Users/user/Bitnami Django Stack projects/MyTestProjOne')
os.environ.setdefault("PYTHON_EGG_CACHE", "C:/Users/user/Bitnami Django Stack projects/MyTestProjOne/egg_cache")
from django.core.wsgi import get_wsgi_application
os.environ["DJANGO_SETTINGS_MODULE"] = "MyTestProjOne.settings"
application = get_wsgi_application()
and for Project 2 ("Project") wsgi.py
:
from django.core.wsgi import get_wsgi_application
os.environ['DJANGO_SETTINGS_MODULE'] = "Project.settings"
application = get_wsgi_application()
my httpd-app.conf
for Apache:
<VirtualHost _default_:8007>
DocumentRoot "C:/Bitnami/djangostack-1.8/apache2/htdocs"
<Directory "C:/Bitnami/djangostack-1.8/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3 >
Require all granted
</IfVersion>
</Directory>
# Error Documents
ErrorDocument 503 /503.html
# Bitnami applications installed with a prefix URL (default)
Include "C:/Users/user/Bitnami Django Stack projects/Project/conf/httpd-app.conf"
Include "C:/Users/user/Bitnami Django Stack projects/MyTestProjOne/conf/httpd-app.conf""
</VirtualHost>
MyTestProjOne httpd-app.conf
:
WSGIScriptAlias /MyTestProjOne 'C:/Users/user/Bitnami Django Stack projects/MyTestProjOne/MyTestProjOne/wsgi.py'
<Directory "C:/Users/user/Bitnami Django Stack projects/MyTestProjOne/MyTestProjOne">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
WSGIApplicationGroup %{GLOBAL}
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
<Directory "C:/Users/user/Bitnami Django Stack projects/MyTestProjOne">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
Alias /staticMyTestProjOne "C:/Users/user/Bitnami Django Stack Projects/MyTestProjOne/static"
Project httpd-app.conf
:
Alias /static "C:/Users/user/Bitnami Django Stack Projects/Project/static"
WSGIScriptAlias /Project 'C:/Users/user/Bitnami Django Stack projects/Project/Project/wsgi.py'
<Directory "C:/Users/user/Bitnami Django Stack projects/Project/Project">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
<Directory "C:/Users/user/Bitnami Django Stack projects/Project">
WSGIApplicationGroup %{GLOBAL}
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
Upvotes: 1
Views: 313
Reputation: 58533
Don't set:
WSGIApplicationGroup %{GLOBAL}
You are forcing both applications to run in the same interpreter context, which Django doesn't support because of use of environment variables.
See related information in:
Upvotes: 2