On Tue, Jul 10, 2007 at 04:13:44PM -0400, Max Battcher wrote:
> 
> On 7/10/07, Forest Bond <[EMAIL PROTECTED]> wrote:
> > So, the problem is that I have to update my urls.py to include the /mysite/
> > prefix in all URLs.
> >
> > ...
> >
> > If this can be solved using some crazy middleware-type solution, I'd be 
> > open to
> > that.  It doesn't seem ideal to me for the current behavior to be the 
> > default,
> > though.
> 
> Fixing the URLs redundancy is easy, create a new mysite_urls.py and
> mysite_settings.py for the site at /mysite/.  In mysite_settings put
> the ROOT_URLCONF to mysite_urls.py and mysite_urls just needs the
> simple url pattern ('^mysite/', include('urls.py')) to match the new
> "global" prefix.  You can do the same for other sites or it would be
> easy enough to use a more generic prefix regex and share the same
> prefix matching urls and trade off a little regex efficiency...  Each
> site should have its own settings anyway, at the very least for
> separate SITE_IDs.  (Settings is just python, so you can easily
> inherit some base settings with a line like ``from base_settings
> import *``.)

Yes, that would work, and I've done similar things for other situations, but I'm
really just having a hard time seeing why django even cares about /mysite/ at
all.

The solution you mention here requires me to add two python source files to my
tree, and in the end, if I want to move my app to a different URL, I still have
to change both the apache configuration and mysite_urls.py.  It just shouldn't
be that complicated, should it?

I figure I should just have to change the apache configuration, which is where
django instances are mapped to URLs.  urls.py is where django views are mapped
to sub-urls of the main django instance, right?

-Forest

Attachment: signature.asc
Description: Digital signature

Reply via email to