osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: [modwsgi] Windows + Django + Apache 2.2 and
multiple Virtual Hosts - msg#00046

List: modwsgi

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index


I am not able to start multiple hosts on my Windows/Apache/Django.
The second entry crashes Apache with error 500. If I switch my
servers around, it is still always the second one that crashes. Is
this a non workable setup on Windows without multiple daaemon
processes for each application?

Log says:

[Sat Sep 05 09:30:58 2009] [error] Unable to read settings_local.py
[Sat Sep 05 09:30:58 2009] [error] [client 10.0.0.5] mod_wsgi
(pid=6052): Exception occurred processing WSGI script 'C:/path/app2/
apache/django.wsgi'.


NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain1.no
WSGIScriptAlias / "/path/app1/apache/django.wsgi"
<Directory "/path/app1/apache">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain2.no
WSGIScriptAlias / "/path/app2/apache/django.wsgi"
<Directory "/path/app2/apache">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


My wsgi files are identical

import os, sys
WSGI_ROOT = os.path.normpath(os.path.dirname(__file__))
home = WSGI_ROOT + '/../'
if not home in sys.path:
sys.path.insert(0, home)

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

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

Thread at a glance:

Previous Message by Date:

[modwsgi] Re: Multiple apps with different python module paths?

On Sep 4, 10:50 pm, Graham Dumpleton <graham.dumple...@xxxxxxxxx> wrote: > 2009/9/5 leres <craigle...@xxxxxxxxx>: > >    import os > >    import sys > >    home = os.path.dirname(__file__) > >    if home in sys.path: > >        sys.path.remove(home) > >    sys.path.insert(0, home) > > One more thing. Rather than remove, preferred that you just do: > >   if not home in sys.path: >     sys.path.insert(0, home) Actually, I'm not expecting the application's directory to be on the path but if it is I want it to be the first thing on the path. > Since you are naming your files with .py extension be mindful of the > double import problem explained in: Now that I understand how this works a little bit better, I've renamed my codep's to use the wsgi extension. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modwsgi@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to modwsgi+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---

Next Message by Date:

[modwsgi] Re: Windows + Django + Apache 2.2 and multiple Virtual Hosts

2009/9/5 Steinar Rune Eriksen <s.r.eriksen@xxxxxxxxx>: > > I am not able to start multiple hosts on my Windows/Apache/Django. > The second entry crashes Apache with error 500. If you are getting a 500 error response, you aren't actually crashing Apache, just the requests are failing. The questions is whether it is a 500 error from Apache/mod_wsgi or from Django. > If I switch my > servers around, it is still always the second one that crashes. Is > this a non workable setup on Windows without multiple daaemon > processes for each application? Generally it would work fine. There are some caveats, but doubt very much that they would be your problem at this point. > Log says: > > [Sat Sep 05 09:30:58 2009] [error] Unable to read settings_local.py > [Sat Sep 05 09:30:58 2009] [error] [client 10.0.0.5] mod_wsgi > (pid=6052): Exception occurred processing WSGI script 'C:/path/app2/ > apache/django.wsgi'. What was the rest of the error log output around that section? There is likely a Python error traceback and other stuff. Please post sections from before and after that point. Basically anything onwards from point you made the request. > NameVirtualHost *:80 > > <VirtualHost *:80> >        ServerName www.domain1.no >        WSGIScriptAlias / "/path/app1/apache/django.wsgi" >        <Directory "/path/app1/apache"> >                AllowOverride None >                Options None >                Order allow,deny >                Allow from all >        </Directory> > </VirtualHost> > > <VirtualHost *:80> >        ServerName www.domain2.no >        WSGIScriptAlias / "/path/app2/apache/django.wsgi" >        <Directory "/path/app2/apache"> >                AllowOverride None >                Options None >                Order allow,deny >                Allow from all >        </Directory> > </VirtualHost> > > > My wsgi files are identical > > import os, sys > WSGI_ROOT = os.path.normpath(os.path.dirname(__file__)) You shouldn't need os.path.normpath(). > home = WSGI_ROOT + '/../' Read up Python documentation about os.path.join(). This is possible wrong anyway, as you generally would use two directories above the 'apache' subdirectory you created. > if not home in sys.path: >    sys.path.insert(0, home) > > os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' Always a bad idea to use just settings. You should set sys.path to be directory containing your Django instances, not the Django instances themselves. The DJANGO_SETTINGS_MODULE variable should then reference the site name, ie., directory the instance is stored in. > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modwsgi@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to modwsgi+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---

Previous Message by Thread:

[modwsgi] File-input and Wsgi

Im getting form-values nicely: form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ) However, file- html input field is returned as MiniFieldStorage object instead of FieldStorage object. I have read cgi documentation in http://docs.python.org/library/cgi.html but no luck. Any idea why my file uploads are not working? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modwsgi@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to modwsgi+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---

Next Message by Thread:

[modwsgi] Re: Windows + Django + Apache 2.2 and multiple Virtual Hosts

2009/9/5 Steinar Rune Eriksen <s.r.eriksen@xxxxxxxxx>: > > I am not able to start multiple hosts on my Windows/Apache/Django. > The second entry crashes Apache with error 500. If you are getting a 500 error response, you aren't actually crashing Apache, just the requests are failing. The questions is whether it is a 500 error from Apache/mod_wsgi or from Django. > If I switch my > servers around, it is still always the second one that crashes. Is > this a non workable setup on Windows without multiple daaemon > processes for each application? Generally it would work fine. There are some caveats, but doubt very much that they would be your problem at this point. > Log says: > > [Sat Sep 05 09:30:58 2009] [error] Unable to read settings_local.py > [Sat Sep 05 09:30:58 2009] [error] [client 10.0.0.5] mod_wsgi > (pid=6052): Exception occurred processing WSGI script 'C:/path/app2/ > apache/django.wsgi'. What was the rest of the error log output around that section? There is likely a Python error traceback and other stuff. Please post sections from before and after that point. Basically anything onwards from point you made the request. > NameVirtualHost *:80 > > <VirtualHost *:80> >        ServerName www.domain1.no >        WSGIScriptAlias / "/path/app1/apache/django.wsgi" >        <Directory "/path/app1/apache"> >                AllowOverride None >                Options None >                Order allow,deny >                Allow from all >        </Directory> > </VirtualHost> > > <VirtualHost *:80> >        ServerName www.domain2.no >        WSGIScriptAlias / "/path/app2/apache/django.wsgi" >        <Directory "/path/app2/apache"> >                AllowOverride None >                Options None >                Order allow,deny >                Allow from all >        </Directory> > </VirtualHost> > > > My wsgi files are identical > > import os, sys > WSGI_ROOT = os.path.normpath(os.path.dirname(__file__)) You shouldn't need os.path.normpath(). > home = WSGI_ROOT + '/../' Read up Python documentation about os.path.join(). This is possible wrong anyway, as you generally would use two directories above the 'apache' subdirectory you created. > if not home in sys.path: >    sys.path.insert(0, home) > > os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' Always a bad idea to use just settings. You should set sys.path to be directory containing your Django instances, not the Django instances themselves. The DJANGO_SETTINGS_MODULE variable should then reference the site name, ie., directory the instance is stored in. > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modwsgi@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to modwsgi+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!