One minor question. I'd like to test multiple mod_wsgi Django apps locally, each accessed like localhost/app*. Can I simply use the above directives for each app in httpd.conf without using a VirtualHost for each app?
Chris On Sun, Sep 14, 2008 at 11:43 PM, Chris Spencer <[EMAIL PROTECTED]> wrote: > Nevermind. I just found your post on this issue at > http://code.google.com/p/modwsgi/wiki/ConfigurationIssues > > On Sun, Sep 14, 2008 at 11:32 PM, Chris Spencer <[EMAIL PROTECTED]> wrote: >> Ok, so this is what I put at the bottom of my httpd.conf: >> >> WSGIDaemonProcess myapp processes=1 threads=25 >> WSGIProcessGroup myapp >> Alias /myapp/static /usr/local/django/myapp/static/ >> <Directory /usr/local/django/myapp/static/> >> Order deny,allow >> Allow from all >> </Directory> >> WSGIScriptAlias /myapp /usr/local/django/myapp/apache/django.wsgi >> <Directory /usr/local/django/myapp/apache> >> Order deny,allow >> Allow from all >> </Directory> >> >> Everything in /myapp/static/* loads fine. However, all other requests >> that got to django.wsgi generate this error to my Apache log: >> >> [Sun Sep 14 23:26:09 2008] [error] [client 127.0.0.1] (13)Permission >> denied: mod_wsgi (pid=344): Unable to connect to WSGI daemon process >> 'myapp' on '/etc/httpd/logs/wsgi.28572.2.1.sock' after multiple >> attempts. >> >> Any thoughts? The above is what the docs use as the standard recipe >> for running Django with mod_wsgi. Am I missing anything? >> >> Regards, >> Chris >> >> On Thu, Sep 11, 2008 at 9:06 PM, Graham Dumpleton >> <[EMAIL PROTECTED]> wrote: >>> >>> >>> >>> On Sep 12, 10:35 am, "Chris Spencer" <[EMAIL PROTECTED]> wrote: >>>> On Thu, Sep 11, 2008 at 6:16 AM, Graham Dumpleton >>>> >>>> >>>> >>>> <[EMAIL PROTECTED]> wrote: >>>> > Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be >>>> > multiprocess. Thus where you think it is being loaded on every >>>> > request, it is more likely just the result of the various processes >>>> > loading the application the first time it is used. After they are all >>>> > loaded, you shouldn't see loading occurring. >>>> >>>> > Anyway this is it in simple terms, as it is actually more complicated >>>> > than that as Apache can kill off processes and replace them in certain >>>> > situations. >>>> >>>> > For some details of how processes are used in Apache/mod_wsgi see: >>>> >>>> > http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading >>>> >>>> > To know what is definitively what is going on, following instructions >>>> > in: >>>> >>>> > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques >>>> >>>> > and set: >>>> >>>> > LogLevel info >>>> >>>> > in Apache configuration, in place of default 'warn'. This should >>>> > result in mod_wsgi outputing a lot of information into main and per >>>> > virtual host, as appropriate, error logs about when processes are >>>> > being started/restarted and when WSGI application scripts being >>>> > loaded. >>>> >>>> > So do that and report on what you see, including examples of Apache >>>> > error logs which you believe shows the behaviour you are claiming. >>>> >>>> I set LogLevel, and after each request, the only thing I'm seeing in >>>> the log is something like: >>>> [Thu Sep 11 20:17:37 2008] [info] mod_wsgi (pid=18858): Create >>>> interpreter 'localhost.localdomain|/myapp'. >>>> [Thu Sep 11 20:17:37 2008] [info] [client 127.0.0.1] mod_wsgi >>>> (pid=18858, process='', application='localhost.localdomain|/myapp'): >>>> Loading WSGI script '/usr/local/django/myapp/apache/django.wsgi'., >>>> referer:http://localhost/myapp >>>> >>>> Is there any way to force a specific WSGI app to run on a single >>>> process, without changing the number of processes used otherwise on >>>> the server? I've toyed around with WSGIDaemonProcess, but all this >>>> seems to do is break the debugger without fixing the problem. Would I >>>> use something like: >>>> >>>> WSGIDaemonProcess myapp processes=1 threads=1 >>> >>> Which debugger? Any specific reason you are using a single thread, >>> such as using older Django version or your application is not >>> multithread? >>> >>> Anyway, the in web browser debuggers I know of will only work if one >>> process, but 'processes=1' still marks it as multiprocess in WSGI >>> environment. Just drop 'processes=1' and let if use default of 1 >>> process. If you don't do that the debugger may complain it is not >>> running in valid environment. Thus: >>> >>> WSGIDaemonProcess myapp thread=1 >>> WSGIProcessGroup myapp >>> >>> For more information on web browser debuggers and debugging in general >>> see: >>> >>> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques >>> >>> Also see comments about WSGI multiprocess/multithread flags in: >>> >>> http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading >>> >>> For configuration of WSGIDaemonProcess see examples in: >>> >>> http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide >>> http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines >>> http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives >>> >>> Sorry, but have to run somewhere. Will check later than I actually >>> answered your question. I may not have. ;-) >>> >>> Graham >>> >>>> How does that directive differentiate between multiple WSGI apps >>>> running on the same server? The docs mention that it specifies a >>>> "process group", but how do you make a single WSGI Django app run in >>>> that process group? >>>> >>>> > Also, you should still post the configuration you use so we can >>>> > confirm it is correct. I have many times had people say they followed >>>> > the documentation, but in fact they had tweaked it slightly and >>>> > inadvertently caused problems for themselves. >>>> >>>> What I posted is my exact configuration. It's a simple minimal case >>>> app for testing this problem. >>>> >>>> Regards, >>>> Chris >>> >>> >>> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---