Loading...

modwsgi@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [modwsgi] Re: Multiple Django Virtual Hosts on Apache+mod_wsgi but only one gets served Graham Dumpleton Mon Feb 20 17:00:11 2012

Next you could amend your Django WSGI script files to have a simple
WSGI application wrapper around the Django one which rather than
return the WSGI environment information like with prior test, prints
it to Apache error log using 'print'. You could also print os.environ
so can confirm what DJANGO_SETTINGS_MODULE is set to. Plus what
sys.path is set to.

Graham

On 20 February 2012 10:41, Chris Cuilla <[EMAIL PROTECTED]> wrote:
> Changing the WSGIDaemonProcess app_??? user=www-data group=www-data as
> suggested, it looks like each definitely has a different PID.
>
> I'm guessing there's something in the scripts that I'm doing wrong.
>
>
> On Feb 19, 4:37 pm, Chris Cuilla <[EMAIL PROTECTED]> wrote:
>> Here are the scripts. Note that both are the same except for the app
>> names:
>>
>> import os
>> import sys
>>
>> sys.path.insert(0, '/home/appa/public_html/appa.com')
>> sys.path.insert(0, '/home/appa/public_html/appa.com/appa')
>>
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'appa.settings'
>>
>> import django.core.handlers.wsgi
>> application = django.core.handlers.wsgi.WSGIHandler()
>>
>> import os
>> import sys
>>
>> sys.path.insert(0, '/home/appb/public_html/appb.ws')
>> sys.path.insert(0, '/home/appb/public_html/appb.ws/appb')
>>
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'appb.settings'
>>
>> import django.core.handlers.wsgi
>> application = django.core.handlers.wsgi.WSGIHandler()
>>
>> On Feb 19, 4:05 pm, Graham Dumpleton <[EMAIL PROTECTED]>
>> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Try again. This time use:
>>
>> > WSGIDaemonProcess app_??? user=www-data group=www-data
>>
>> > Ie., drop processes/threads option. That way each daemon process group
>> > has only one process and so can meaningfully compare process IDs for
>> > each to make sure different.
>>
>> > Also provide copies of the two WSGI script files using for Django setup.
>>
>> > Graham
>>
>> > On 20 February 2012 08:59, Chris Cuilla <[EMAIL PROTECTED]> wrote:
>>
>> > > Sorry for the delay. Hope you're still out there. Here is the output
>> > > from the recommended debugging script for two apps (appa and appb)
>> > > configured at the same time on the same server:
>>
>> > > PID: 13699
>> > > UID: 33
>> > > GID: 33
>>
>> > > DOCUMENT_ROOT: '/home/appa/public_html/appa.com/'
>> > > GATEWAY_INTERFACE: 'CGI/1.1'
>> > > HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/
>> > > *;q=0.8'
>> > > HTTP_ACCEPT_ENCODING: 'gzip, deflate'
>> > > HTTP_ACCEPT_LANGUAGE: 'en-us'
>> > > HTTP_CACHE_CONTROL: 'max-age=0'
>> > > HTTP_CONNECTION: 'keep-alive'
>> > > HTTP_COOKIE: 'csrftoken=a44bec4e72d4792845c65a8be67669a2'
>> > > HTTP_HOST: 'appa-test'
>> > > HTTP_USER_AGENT: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3)
>> > > AppleWebKit/534.53.11 (KHTML, like Gecko) Version/5.1.3 Safari/
>> > > 534.53.10'
>> > > PATH_INFO: '/'
>> > > PATH_TRANSLATED: '/home/appa/public_html/appa.com/appa/app.wsgi/'
>> > > QUERY_STRING: ''
>> > > REMOTE_ADDR: '192.168.0.5'
>> > > REMOTE_PORT: '54460'
>> > > REQUEST_METHOD: 'GET'
>> > > REQUEST_URI: '/'
>> > > SCRIPT_FILENAME: '/home/appa/public_html/appa.com/appa/app.wsgi'
>> > > SCRIPT_NAME: ''
>> > > SERVER_ADDR: '192.168.0.254'
>> > > SERVER_ADMIN: '[EMAIL PROTECTED]'
>> > > SERVER_NAME: 'appa-test'
>> > > SERVER_PORT: '80'
>> > > SERVER_PROTOCOL: 'HTTP/1.1'
>> > > SERVER_SIGNATURE: '<address>Apache/2.2.20 (Ubuntu) Server at appa-test
>> > > Port 80</address>\n'
>> > > SERVER_SOFTWARE: 'Apache/2.2.20 (Ubuntu)'
>> > > mod_wsgi.application_group: 'appa-test|'
>> > > mod_wsgi.callable_object: 'application'
>> > > mod_wsgi.handler_script: ''
>> > > mod_wsgi.input_chunked: '0'
>> > > mod_wsgi.listener_host: ''
>> > > mod_wsgi.listener_port: '80'
>> > > mod_wsgi.process_group: 'appa'
>> > > mod_wsgi.request_handler: 'wsgi-script'
>> > > mod_wsgi.script_reloading: '1'
>> > > mod_wsgi.version: (3, 3)
>> > > wsgi.errors: <mod_wsgi.Log object at 0x2273a110>
>> > > wsgi.file_wrapper: <built-in method file_wrapper of mod_wsgi.Adapter
>> > > object at 0x226aade8>
>> > > wsgi.input: <mod_wsgi.Input object at 0x2273a020>
>> > > wsgi.multiprocess: True
>> > > wsgi.multithread: True
>> > > wsgi.run_once: False
>> > > wsgi.url_scheme: 'http'
>> > > wsgi.version: (1, 1)
>>
>> > > PID: 13702
>> > > UID: 33
>> > > GID: 33
>>
>> > > DOCUMENT_ROOT: '/home/appb/public_html/appb.ws/'
>> > > GATEWAY_INTERFACE: 'CGI/1.1'
>> > > HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/
>> > > *;q=0.8'
>> > > HTTP_ACCEPT_ENCODING: 'gzip, deflate'
>> > > HTTP_ACCEPT_LANGUAGE: 'en-us'
>> > > HTTP_CACHE_CONTROL: 'max-age=0'
>> > > HTTP_CONNECTION: 'keep-alive'
>> > > HTTP_HOST: 'appb-test'
>> > > HTTP_USER_AGENT: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3)
>> > > AppleWebKit/534.53.11 (KHTML, like Gecko) Version/5.1.3 Safari/
>> > > 534.53.10'
>> > > PATH_INFO: '/'
>> > > PATH_TRANSLATED: '/home/appb/public_html/appb.ws/appb/app.wsgi/'
>> > > QUERY_STRING: ''
>> > > REMOTE_ADDR: '192.168.0.5'
>> > > REMOTE_PORT: '54461'
>> > > REQUEST_METHOD: 'GET'
>> > > REQUEST_URI: '/'
>> > > SCRIPT_FILENAME: '/home/appb/public_html/appb.ws/appb/app.wsgi'
>> > > SCRIPT_NAME: ''
>> > > SERVER_ADDR: '192.168.0.254'
>> > > SERVER_ADMIN: '[EMAIL PROTECTED]'
>> > > SERVER_NAME: 'appb-test'
>> > > SERVER_PORT: '80'
>> > > SERVER_PROTOCOL: 'HTTP/1.1'
>> > > SERVER_SIGNATURE: '<address>Apache/2.2.20 (Ubuntu) Server at appb-test
>> > > Port 80</address>\n'
>> > > SERVER_SOFTWARE: 'Apache/2.2.20 (Ubuntu)'
>> > > mod_wsgi.application_group: 'appb-test|'
>> > > mod_wsgi.callable_object: 'application'
>> > > mod_wsgi.handler_script: ''
>> > > mod_wsgi.input_chunked: '0'
>> > > mod_wsgi.listener_host: ''
>> > > mod_wsgi.listener_port: '80'
>> > > mod_wsgi.process_group: 'appb'
>> > > mod_wsgi.request_handler: 'wsgi-script'
>> > > mod_wsgi.script_reloading: '1'
>> > > mod_wsgi.version: (3, 3)
>> > > wsgi.errors: <mod_wsgi.Log object at 0x2273a110>
>> > > wsgi.file_wrapper: <built-in method file_wrapper of mod_wsgi.Adapter
>> > > object at 0x226aade8>
>> > > wsgi.input: <mod_wsgi.Input object at 0x2273a020>
>> > > wsgi.multiprocess: True
>> > > wsgi.multithread: True
>> > > wsgi.run_once: False
>> > > wsgi.url_scheme: 'http'
>> > > wsgi.version: (1, 1)
>>
>> > > On Feb 6, 7:08 pm, Graham Dumpleton <[EMAIL PROTECTED]>
>> > > wrote:
>> > >> Next thing to try would be to replace the WSGI scripts with one which
>> > >> echos WSGI environ.
>>
>> > >>http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Displaying_...
>>
>> > >> Then compare what environ is for requests against different virtual
>> > >> hosts to see if that gives a clue.
>>
>> > >> Strip any really sensitive information, trying not to change the
>> > >> meaning, and post it.
>>
>> > >> Graham
>>
>> > >> On 7 February 2012 12:55, Chris Cuilla <[EMAIL PROTECTED]> wrote:
>>
>> > >> > Graham -
>>
>> > >> > Thanks for the response. A couple of things:
>>
>> > >> > Virtual hosts works fine when they are not mod_wsgi ghosts. When they
>> > >> > just plain, vanilla it works just fine. Not sure that matters, but
>> > >> > seems like the problems is some how related to mod_wsgi config.
>>
>> > >> >> First thing to check is that you have:
>>
>> > >> >>   NameVirtualHost *:80
>>
>> > >> >> directive present and that it isn't commented out.
>>
>> > >> > Yeah, that's set.
>>
>> > >> >> One other thing you can do is add in a default VirtualHost as very
>> > >> >> first one, which from memory is defined as:
>>
>> > >> >> <VirtualHost __default__:80>
>> > >> >> Deny from all
>> > >> >> </VirtualHost>
>>
>> > >> >> With that in place, if named virtual host lookup is failing, will go
>> > >> >> to that and you will get a forbidden error, rather than it going to
>> > >> >> wrong virtual host.
>>
>> > >> > I tried that but it seems to shut out everything.
>>
>> > >> > Thanks for the suggestions.
>>
>> > >> > --
>> > >> > You received this message because you are subscribed to the Google 
>> > >> > Groups "modwsgi" group.
>> > >> > To post to this group, send email to [EMAIL PROTECTED]
>> > >> > To unsubscribe from this group, send email to [EMAIL PROTECTED]
>> > >> > For more options, visit this group 
>> > >> > athttp://groups.google.com/group/modwsgi?hl=en.
>>
>> > > --
>> > > You received this message because you are subscribed to the Google 
>> > > Groups "modwsgi" group.
>> > > To post to this group, send email to [EMAIL PROTECTED]
>> > > To unsubscribe from this group, send email to [EMAIL PROTECTED]
>> > > For more options, visit this group 
>> > > athttp://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To post to this group, send email to [EMAIL PROTECTED]
> To unsubscribe from this group, send email to [EMAIL PROTECTED]
> For more options, visit this group at 
> http://groups.google.com/group/modwsgi?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.