Opened 7 years ago

Closed 6 years ago

#11086 closed (worksforme)

Django not recieveing the mountpoint when using mod_wsgi

Reported by: emperorcezar Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Graham.Dumpleton@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


This is only occurring with multiple mountpoints. Below you will find my config. /password isn't being passed the /password when used in my url. For example. When I go to the url django only gets the path /update/

When using the second mount point it gets passed the entire url.

I'm able to work around this using the workaround mentioned in the Integration Documentation to get /password to be passed.

I'm not sure what is correct, for it to be passed or not, but I'm pretty sure that it should be consistent for each mountpoint.

My config, all in the same virtual host.

    WSGIDaemonProcess password
    WSGIProcessGroup password
    WSGIReloadMechanism Process

    WSGIScriptAlias /password /example/migrationpassword/apache/django.wsgi

    Alias /media/ /example/migrationpassword/media/

    WSGIDaemonProcess endofyearshow
    WSGIProcessGroup endofyearshow
    WSGIReloadMechanism Process

    WSGIScriptAlias /endofyearshow /example/endofyearshow/apache/django.wsgi

    Alias /media/ /example/endofyearshow/static/

Change History (2)

comment:1 Changed 7 years ago by grahamd

  • Cc Graham.Dumpleton@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

As per WSGI specification, the mount point gets passed in SCRIPT_NAME, with remainder of the URL in PATH_INFO. So, the mount point should never appear in the path used within application to resolve stuff. As such, your comment that in your view it is working how you expect for '/endofyearshow' is a bit suspect. The only time that this may get stuffed up is if you aren't using Django 1.0+ for both applications and one was actually running an older version of Django where Django did things a bit differently and didn't honour the mount point specified in SCRIPT_NAME.

So, state what versions of Django is being used for each. Then also add the following at end of each WSGI script file. Use that to determine what SCRIPT_NAME and PATH_INFO are for each instance and post details.

import cStringIO

def application(environ, start_response):
    headers = []
    headers.append(('Content-Type', 'text/plain'))
    write = start_response('200 OK', headers)

    input = environ['wsgi.input']
    output = cStringIO.StringIO()

    keys = environ.keys()
    for key in keys:
        print >> output, '%s: %s' % (key, repr(environ[key]))
    print >> output

    output.write('CONTENT_LENGTH', '0'))))

    return [output.getvalue()]

Also perhaps post what you have in so can see if you are correctly setting up rules such that they do not mention the mount point.

comment:2 Changed 6 years ago by russellm

  • Resolution set to worksforme
  • Status changed from new to closed

Marking worksforme based on the lack of any followup to Graham's comments.

Note: See TracTickets for help on using tickets.
Back to Top