On Mon, 2009-03-23 at 13:34 -0700, Ross wrote:
> I'm a bit confused by finding a process that works for both the dev
> server and mod_python.
> 
> Mod_python uses a 'trigger' word to know to pass serving of that stuff
> by Django.  So URL's with /mysite/ leading them get handled by
> Django.  But it seems that the urls.py then gets the URL without the
> leading /mysite/ element.

The leading prefix is called the "script name" (after the web server
variable SCRIPT_NAME) and is indeed stripped. The remaineder -- "path
info" is what Django processes.

> 
> The dev server however would pass along the full URL.   So if I have a
> URL that I am targetting which is /mysite/soStuff

The development server is a limited development environment and
(intentionally) doesn't have all the features of a fully blown
webserver. I'm not sure how I'd feel about adding this feature to it.
It's a bit of a "meh" issue, really.

> 
> my URL conf will service the request when using the dev server with:
>   (r'^mysite/doStuff/$', 'mysite.project.views.doSomething'),
> 
> whereas the same click handled by mod_python will need an URL conf:
>  (r'^doStuff/$', 'mysite.project.views.doSomething'),
> 
> To make me more confused, there is a cryptic line in the documentation
> that doesn't make sense to me:
> 
>     Django's URLconfs won't trim the "/mysite/" -- they get passed the
> full URL

That's a bug in the documentation. It used to be that way in the code,
but we fixed it to handle SCRIPT_NAMEs properly.

> Anyway, I don't know how I can make my urls.py work for both dev-
> server and mod_python, short of having two url-confs for every URL,
> which I am awkwardly doing for now.   I must be missing something
> here, so your help would be appreciated..

If the dev server doesn't meet your needs and you need a full webserver,
then do exactly that: use a full-powered web server. Normally, though,
this shouldn't really matter. All the links within your site can be made
to work without caring about the SCRIPT_NAME (e.g. the "url" template
tag adds it when required), so it's good practice to build your site
being able to move it to a different SCRIPT_NAME prefix.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to