Thanks a bunch for all the help, it now fully and correctly works
though I had to change the rewriterules a bit, I ended up with this:
RewriteEngine On
RewriteRule ^$ /amelie.wsgi [QSA,PT,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /amelie.wsgi/$1 [QSA,PT,L]
Doing it like this also ensures wsgi doesn't try to get involved when
the dir on the server exists but adding that line means wsgi is gassed-
by when requesting / so in order to prevent that I added the first
rewriterule.
On Dec 10, 9:56 pm, Graham Dumpleton <[email protected]>
wrote:
> 2009/12/11 Daenney <[email protected]>:
>
> > I'm not that great when it comes to python which got me stuck here:
>
> > -- amelie.wsgi
> > def _application(environ, start_response):
>
> > import os, sys
> > sys.path.append('/data/applications')
> > sys.path.append('/data/applications/amelie')
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'amelie.settings'
>
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> Change this to:
>
> import os, sys
> sys.path.append('/data/applications')
> sys.path.append('/data/applications/amelie')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'amelie.settings'
>
> import django.core.handlers.wsgi
> _application = django.core.handlers.wsgi.WSGIHandler()
>
> Ie., get rid of the function, deindenting what you put in it, and just
> call the WSGIHandler() object instance '_application'.
>
> Graham
>
>
>
> > import posixpath
> > def application(environ, start_response):
> > # Wrapper to set SCRIPT_NAME to actual mount point.
> > environ['SCRIPT_NAME'] = posixpath.dirname(environ['SCRIPT_NAME'])
> > if environ['SCRIPT_NAME'] == '/':
> > environ['SCRIPT_NAME'] = ''
> > return _application(environ, start_response)
>
> > This though gives me the following error:
>
> > [Thu Dec 10 20:33:06 2009] [error] [client 130.89.233.209] TypeError:
> > 'NoneType' object is not iterable
> > [Thu Dec 10 20:33:10 2009] [error] [client 10.10.3.5] mod_wsgi
> > (pid=36147): Exception occurred processing WSGI script '/data/htdocs/
> > http/amelie.wsgi'.
> > [Thu Dec 10 20:33:10 2009] [error] [client 10.10.3.5] TypeError:
> > 'NoneType' object is not iterable.
>
> > It would seem it is not entirely happy about the def _application not
> > returning anything if I'm getting this correctly...
>
> > On Dec 3, 11:09 pm, Graham Dumpleton <[email protected]>
> > wrote:
> >> 2009/12/4 Daenney <[email protected]>:
>
> >> > Perhaps this has been documented somewhere before and in that case I
> >> > apologise for not being able to find the solution.
>
> >> > My problem is the following:
>
> >> > I have a django-app named Amelie running in /data/apps/amelie and an
> >> > apache httpd running for my domain with a doc-root of /data/htdocs
>
> >> > The application is mounted on / which means wsgi "steals" all the URL
> >> > requests and handles them but I only want wsgi to come in play when
> >> > the requested URL doesn't physically exist in the doc-root.
>
> >> > An example of the behavior I'm trying to accomplish.
>
> >> > When the following URL is requested:
> >> >www.example.com/teletubies
> >> > And /data/htdocs/teletubies exists then just serve the content of that
> >> > directory, else give the request to wsgi and hence the django-app
> >> > because it might know what to do with it or will throw a 404 instead.
>
> >> > Anyone got a clue as how to do this?
>
> >> Short on time so very quickly, go read:
>
> >> http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apa...
>
> >> In short, remove the WSGIScriptAlias you have.
>
> >> Put the WSGI script in document root and call it 'site.wsgi'.
>
> >> Make sure not using __file__ as reference anchor in WSGI script file
> >> and instead make paths absolute instead.
>
> >> Make the SCRIPT_NAME fix up as described in that document using WSGI
> >> application wrapper.
>
> >> In Directory directive for DocumentRoot, then add:
>
> >> AddHandler wsgi-script .wsgi
>
> >> RewriteEngine On
> >> RewriteCond %{REQUEST_FILENAME} !-f
> >> RewriteRule ^(.*)$ /site.wsgi/$1 [QSA,PT,L]
>
> >> Read that document for more information. That configuration is towards
> >> the end of that section.
>
> >> In mod_wsgi 4.0 there will likely be a way of doing this which doesn't
> >> need mod_rewrite.
>
> >> If don't understand tell me which bit and will give better explanation
> >> where necessary.
>
> >> Graham
>
> > --
>
> > 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.