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

Saffi saffi.h at gmail.com
Thu Jul 30 08:36:18 IDT 2009


We don't have admin ... we don't have db.

On Wed, Jul 29, 2009 at 11:48 AM, ofri <ofri.raviv at gmail.com> 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/ ?




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:http://127.0.0.1:8080/ping/
>
> 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:http://127.0.0.1:8080/serve/ping/
> and the apachehttp://myapache:80/serve/ping/
>
> Saffi & Ze'ev



-- 
 Saffi



-- 
 Saffi

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---



More information about the Python-il mailing list