[Python-il] [pyweb-il:324] Re: Removing prefix from url.

Meir Kriheli meir at mksoft.co.il
Wed Jul 29 14:44:55 IDT 2009

ofri wrote:
> my problem was actually the opposite: i had to add a prefix to the url
> (because i wanted to run django at ofri.shared_hosting.com/django/*
> but my hosting took requests from ofri.shared_hosting.com/django/* and
> passed them to my apache as if they were requests to
> ofri.shared_hosting.com/* . they do this, because then you have a
> separate apache for each of your web apps, that thinks its running at
> the root. its makes it much easier to configure (usually the default
> config works great). but this caused problem to the admin app. more
> details and my solution (using mod_rewrite) here: http://ofri.webfactional.com/blog/?p=37
> Saffi - how does the admin app behave in your solution? where does the
> <form action=...> in the login form point to? /serve/ping/ or just /
> ping/ ?
We sat on the problem that evening. I have sites deployed under an 
Apache sub directory with mod_python, but since we had problems with net 
connection I couldn't login to the server that night - sorry about that.

Ofri, you need to set django.root in Apache's site configuration, e.g:

PythonOption django.root /knesset

And not include any leading /knesset in your urlconf. In that case 
django will handle setting /admin/ to /knesset/admin/

For more info on django.root see:

and the mod_python handler:

IMO A solid net connection is essential for future meetings.

It was fun.

Meir Kriheli
> On Jul 28, 1:17 pm, Saffi <saff... at gmail.com> wrote:
>> Yesterday Ofri and I talked about the Kneset project.  It reminded me an
>> issue we had.
>> The site url seems different with "runserver" then through the apache. when
>> I run the ./manage.py the request url is processed according to the urls.py.
>> example:
>> for detecting it is django we used /serve/ as url (our project is also
>> called serve). but while running the server in standalone it had no
>> meaning.
>> http://myapache:80/serve/ping/
>> but that can't work since my django does not know the /serve/
>> We want to swallow that "/serve/" prefix so everything would be as "usual"
>> thought the url is a bit different.
>> so in settings.py we directed to a different urls.py
>> # ROOT_URLCONF = 'serve.urls'
>> # skip the prefix /serve/
>> ROOT_URLCONF = 'serve.prefixurls'
>> which in turns delegated to the usual urls.py
>> # prefixurls.py
>> import os
>> from django.conf.urls.defaults import *
>> from django.conf import settings
>> import serve.proxy.views
>> urlpatterns = patterns('',
>>              (r'^serve/', include('serve.urls')),
>>     )
>> Now the standalone server:
>> example:
>> and the apachehttp://myapache:80/serve/ping/
>> Saffi & Ze'ev

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://hamakor.org.il/pipermail/python-il/attachments/20090729/958be9de/attachment.htm 

More information about the Python-il mailing list