I am trying to give a Domain name and run multiple django projects on my apache, for the moment I managed to host one application and and run it on 127.0.0.1:8888 the settings look like this.
WSGIScriptAlias / C:/Users/ShabeerSheffa/workspace/ApacheDemo/ApacheDemo/wsgi.py
WSGIPythonPath C:/Users/ShabeerSheffa/workspace/ApacheDemo
<Directory C:/Users/ShabeerSheffa/workspace/ApacheDemo>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
I tried changing the above code to look like the code below, with a domain name so i could access it using apachedemo.com but failed miserably.
NameVirtualHost apachedemo.com
<VirtualHost apachedemo.com>
ServerName apachedemo.com
ServerAlias www.apachedemo.com
WSGIScriptAlias / C:/Users/ShabeerSheffa/workspace/ApacheDemo/ApacheDemo/wsgi.py
WSGIPythonPath C:/Users/ShabeerSheffa/workspace/ApacheDemo
DocumentRoot C:/Users/ShabeerSheffa/workspace/ApacheDemo
<Directory C:/Users/ShabeerSheffa/workspace/ApacheDemo>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
I am currently using port 8888 for my apache on a windows 7 machine, 127.0.0.1:8888 worked for the first version of the code, but after editing the code apache gives an error when restarting apache.
This is how my host file looks like, i only added the last line.(not quite sure why there is a # in second and third line)
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1:8888 apachedemo.com www.apachedemo.com
I am trying to find answers for two questions-
EDIT: I am developing my projects using eclipse
Thanks alot for the help guys
Try the below configuration out. You might also find this question useful and in the mod wsgi docs there is a section on virtualhosts that might help you as well.
WSGIPythonPath C:/Users/ShabeerSheffa/workspace/ApacheDemo
<VirtualHost apachedemo.com:8888>
ServerName apachedemo.com
WSGIScriptAlias / C:/Users/ShabeerSheffa/workspace/ApacheDemo/ApacheDemo/wsgi.py
<Directory C:/Users/ShabeerSheffa/workspace/ApacheDemo>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
<VirtualHost apachedemo2.com:8888>
ServerName apachedemo2.com
WSGIScriptAlias / C:/Users/ShabeerSheffa/workspace/ApacheDemo/apachedemo2/wsgi.py
<Directory C:/Users/ShabeerSheffa/workspace/ApacheDemo>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
Update
One of the comments below asked can you have different WSGIPythonPath in each virtualhost. Looking at the configuration docs WSGIPythonPath can only be in the context server config and not virtualhost. You can however add to the path in your wsgi files themselves as shown in this answer. You could also try and look at WSGIDaemonProcess with python-path as shown in this question.
Make sure you read:
The auto generated wsgi.py file in Django 1.4 does things in a way that you cannot host two Django instances in same process under different sub interpreters. You will need to change the wsgi.py file.
This is in addition to any issues you may have with Apache configuration if you still have any. Since though you are being vague on exactly what the error is by giving any error messages, it is hard to guess what issue you are having is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With