I'm having a problem with the hand-off from mod_wsgi to django --
specifically with the urls detected/generated by django.

Below...
- Background
- Problem detected
- More info
- My goal
- httpd.conf section
- django.wsgi code
- urls.py section

::> Background...
I'm using django '1.0.2 final', mod_wsgi 2.3, and the standard
django-1.0x-compatible 'django.wsgi' file described at <http://
code.google.com/p/modwsgi/wiki/IntegrationWithDjango>, just after the
text "would be constructed as follows".

::> Problem detected...
1) I try to access 'http://127.0.0.1/studio/admin/'
2) The helpful django 404 DEBUG=True window comes up with the
following info:
[debug start]
Page not found (404)
Request Method:         GET
Request URL:    http://127.0.0.1/admin/

Using the URLconf defined in studio.urls, Django tried these URL
patterns, in this order:

   1. ^studio/admin/(.*)
   2. ^studio/

The current URL, admin/, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 404 page.
[debug end]
3) Note the 'Request URL' above; it does not contain the 'studio'
segment.

::> More info...
- If I try to access 'http://127.0.0.1/studio/studio/admin/' (yes,
that's TWO 'studio' segments), I get the admin screen.
-- At this admin screen I can successfully log in.
-- All the links in the admin screen show the two 'studio' segments,
and do work.
-- However, as soon as any other part of my app explicitly calls a url
with *one* studio segment, the 404 DEBUG=True window comes up as noted
above.

- If I change the 'django.wsgi' file to...
[alternate start]
_application = django.core.handlers.wsgi.WSGIHandler()
def application(environ, start_response):
  environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']
  return _application(environ, start_response)
[alternate end]
-- I *can* access the admin page at 'http://127.0.0.1/studio/admin/'.
-- However, the form's 'action' url contains two studio segments --
and on submitting the login, the url changes to 'http://127.0.0.1/
studio/studio/admin/', and I get the 404 DEBUG=True window which
correctly perceives that the request URL contains two studio segments,
and properly indicates I have no urls for that pattern.

::> My goal...
To have the mod_wsgi setup work (functionally) the same as the built-
in server, in terms of the urls working as expected.

::> httpd.conf section...
<VirtualHost 127.0.0.1:80>
        ServerName 127.0.0.1
        ServerAlias 127.0.0.1
        ServerAdmin (my email address)
        WSGIScriptAlias /studio /Users/birkin/Documents/Brown_Library/
djangoProjects/studio/apache/django.wsgi
        <Directory /Users/birkin/Documents/Brown_Library/djangoProjects/
studio/apache>
                Order allow,deny
                Allow from all
        </Directory>
        WSGIScriptAlias /services /Users/birkin/Documents/Brown_Library/
djangoProjects/services/apache/django.wsgi
        <Directory /Users/birkin/Documents/Brown_Library/djangoProjects/
services/apache>
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

::> django.wsgi code...
[start]
import os, sys
sys.path.append('/Developer_3rd/django_src')
sys.path.append('/Developer_3rd/django_src/django')
sys.path.append('/Users/birkin/Documents/Brown_Library/
djangoProjects')
sys.path.append('/Users/birkin/Documents/Brown_Library/djangoProjects/
studio')

os.environ['DJANGO_SETTINGS_MODULE'] = 'studio.settings'
os.environ['PYTHON_EGG_CACHE'] = '/Users/birkin/Documents/
Brown_Library/djangoProjects/django_cache'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()
[end]

::> urls.py section...
urlpatterns = patterns('',
  ( r'^studio/admin/(.*)',   admin.site.root ),
  ( r'^studio/',   include('studio.studio_app.urls_app') ),
  )


[end of post]

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

Reply via email to