I've read the previous question on this topic, and read the tutorial on the forum, but still something does not add up.
I'm trying to run two Django sites on one Apache instance. I've configured httpd.conf like this:
...
NameVirtualHost *:99999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | # Virtual Hosts
<VirtualHost *:99999>
ServerName www.mysite.net
ServerAlias mysite.net
KeepAlive Off
WSGIDaemonProcess mysite.net processes=1 threads=20 inactivity-timeout=60 display-name=[wsgi-mysite]httpd
WSGIProcessGroup mysite.net
WSGIScriptAlias / /home/username/webapps/django/mysite.wsgi
</VirtualHost>
<VirtualHost *:99999>
ServerName www.mysite2.net
ServerAlias mysite2.net
KeepAlive Off
WSGIDaemonProcess mysite2.net processes=1 threads=20 inactivity-timeout=60 display-name=[wsgi-mysite2]httpd
WSGIProcessGroup mysite2.net
WSGIScriptAlias / /home/username/webapps/django/mysite2.wsgi
</VirtualHost>
|
Other than that, the settings are still unchanged from the defaults that used to work fine for just one site. Then, on the control panel, I have two different sites, each with their own domains and sharing the same Django app. I've restarted apache several times (stopped and started again, as well as restarted). When I access mysite2.net, however, I get the same result as accessing mysite.net (the first website).
Clearly, I've missed some setting somewhere. I have to say, this is my first time working with this kind of thing. Can anyone offer some advice?
UPDATE:
Here is the contents of my two .wsgi files:
| import os
import sys
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
application = WSGIHandler()
|
Mysite2:
| import os
import sys
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite2.settings'
application = WSGIHandler()
|
I don't know what I've changed, but now I'm at least getting an error in my logs, which says the following:
1
2
3
4
5
6
7
8
9
10
11
12 | [Sun Jan 09 10:27:02 2011] [error] [client 127.0.0.1] mod_wsgi (pid=17779): Target WSGI script '/home/username/webapps/django/mysite.wsgi' cannot be loaded as Python module.
[Sun Jan 09 10:27:02 2011] [error] [client 127.0.0.1] mod_wsgi (pid=17779): Exception occurred processing WSGI script '/home/username/webapps/django/mysite.wsgi'.
[Sun Jan 09 10:27:02 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
[Sun Jan 09 10:27:02 2011] [error] [client 127.0.0.1] File "/home/username/webapps/django/mysite.wsgi", line 4, in <module>
[Sun Jan 09 10:27:02 2011] [error] [client 127.0.0.1] from django.core.handlers.wsgi import WSGIHandler
[Sun Jan 09 10:27:02 2011] [error] [client 127.0.0.1] ImportError: No module named django.core.handlers.wsgi
[Sun Jan 09 10:27:03 2011] [error] [client 127.0.0.1] mod_wsgi (pid=17779): Target WSGI script '/home/username/webapps/django/mysite.wsgi' cannot be loaded as Python module.
[Sun Jan 09 10:27:03 2011] [error] [client 127.0.0.1] mod_wsgi (pid=17779): Exception occurred processing WSGI script '/home/username/webapps/django/mysite.wsgi'.
[Sun Jan 09 10:27:03 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
[Sun Jan 09 10:27:03 2011] [error] [client 127.0.0.1] File "/home/username/webapps/django/mysite.wsgi", line 4, in <module>
[Sun Jan 09 10:27:03 2011] [error] [client 127.0.0.1] from django.core.handlers.wsgi import WSGIHandler
[Sun Jan 09 10:27:03 2011] [error] [client 127.0.0.1] ImportError: No module named django.core.handlers.wsgi
|
asked
Jan 09 '11 at 10:15
Herman
72●11
Can you provide the contents of your mysite2.wsgi and mysite1.wsgi files?
I've added more detail, as well as a newly-discovered error-log. Both sites are now reporting an internal error on load (obviously). The .wsgi file for mysite1 used to work fine before, so I don't see why it wouldn't work anymore.
This is not right:
Do you have any strange or trailing characters in your .wsgi file?
I see that (and fixed it), but no, it seems to be some sort of bug with this forum when I try to encapsulate code (I had to repetitively delete '93' from the start and end of my code, I missed that one. In the actual log, there is no '93'. It says
ImportError: No module named django.core.handlers.wsgi