On Jan 4, 12:45 pm, davathar <davat...@gmail.com> wrote: > Here's more information I've been able to find. Evidently there's a > problem in some configurations wheremod_wsgieither isn't receiving > or isn't passing SCRIPT_NAME. > > When I use this test script in the wsgi file I get an empty string as > the value for SCRIPT_NAME. And from what I gather that's where / > helpdesk should be so it can be passed to django so it's aware of the > full path. > > ************** > 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() > keys.sort() > for key in keys: > print >> output, '%s: %s' % (key, repr(environ[key])) > print >> output > > output.write(input.read(int(environ.get('CONTENT_LENGTH', '0')))) > > return [output.getvalue()] > ***************** > > So it may not be as much a django issue as an apache/wsgi one. I'm > not skilled enough to make that distinction though. For now I'm just > going to serve the app from the root and move it when I learn more or > the issue is fixed. > > I tested the admin module and I get the same problem. Wherever the / > helpdesk is present in the URL everything serves properly. But when I > post a form, it's dropped from the path and I get "There is no > application mounted at the root of this domain. " because I have > nothing mounted at the root. I assume that message is served by > apache. > > My host Webfaction uses multiple apache applications where the first > one is shared for the server. I don't get direct access to the > settings for this. Only control panel access which may make some > changes indirectly. I think it uses <Location> settings or maybe > SymLinks? to forward the request to another instance of apache that is > installed with Django on my share of the server. I have total control > of that apache. So, perhaps the first apache isn't passing any value > to the second one to indicate the first "mount point" is present. > This would be the "SCRIPT_NAME" from what I gather.
Unless you are on an old server build, WebFaction uses nginx as front end, not Apache. In either case, the front end mount point isn't passed across. For it all to work properly, the front end mount point must match the backend mount point. You cannot mount on front end as /helpdesk and then have it proxy to / on backend for example. The backend must be mounted at / helpdesk as well. In respect of prior discussion, did you disable mod_rewrite in backend Apache? Graham > Yet another manifestation of the issue can be found by leaving off the > trailing slash at the end of the url : example.com/helpdesk/support/ > case/1 will automatically redirect to example.com/support/case/1/ as > django adds the slash but drops the /helpdesk > > ...com/helpdesk results in "There is no application mounted at the > root of this domain. " > > ....com/helpdesk/ renders the app since my root urls.py contains "(r'^ > $', 'helpdesk.support.views.home')," to call the support app home > view. > > I hope some of this information helps. In the mean time all the work > I've had to do to "move" my code to the root has completely convinced > me of the wisdom of decoupling. ;-) And at the same time the reason > I'm even having the trouble is because of the use of functions like > reverse to avoid hard coding views and templates to urls! > > Thanks for your feedback. > > On Jan 3, 5:50 pm, Karen Tracey <kmtra...@gmail.com> wrote: > > > > > On Sun, Jan 3, 2010 at 5:15 PM, davathar <davat...@gmail.com> wrote: > > > Ramiro, thanks for the links. That other thread does seem to describe > > > the same problem and results in it being identified as a bug in the > > > core urlresolvers. Unfortunately the work around of "RewriteRule ^/ > > > studio$ /studio/ [R] " doesn't work for me for some reason. Maybe I'm > > > misapplying it. > > > > Either way. I'm going to drop this for now and see what happens with > > > the ticket that was opened. It seems like this would be a very big > > > issue if everyone usingmod_wsgihad problems when using django from > > > anywhere other than the root url. But there are few posts about it. > > > So I'm going to start over and see if I missed something critical in > > > my setup. > > > Just to clarify, though it is clear you've already found it, the ticket to > > watch for the problem identified in that thread is: > > >http://code.djangoproject.com/ticket/12464 > > > The other one (#9435) mentioned earlier describes a somewhat different > > problem. The thread and ticket #12464 show a problem determining the script > > name only when the PATH_INFO for the current request is completely empty. > > So reverse called from (or url tag in a template rendered by) the view that > > handles the root page sees a problem, when it is called as a result of a a > > request for (in your case): > > > ...com/helpdesk > > > but not: > > > ....com/helpdesk/ > > > because in the 2nd case PATH_INFO is not empty, it is '/'. > > > Based on the urls you were mentioning earlier in the thread it wasn't clear > > whether the problem with reverse, in your case, is limited to reversals > > attempted while serving the root (for your project) page, when requested > > without a trailing slash. If the rewrite rule is not working, then I > > suspect you are seeing a different problem, but I don't know what is causing > > it. I have been able to mount Django projects not at the root of the URL > > tree with Apache/mod_wsgi, and reverse works correctly. > > > Do the links within admin work? That was one curiosity noted in the earlier > > thread (admin links did work) that pointed toward the fact that the problem > > was only when serving the root page. > > > Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.