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

ofri ofri.raviv at gmail.com
Thu Jul 30 17:28:43 IDT 2009


my httpd.conf:

ServerRoot "/home/ofri/webapps/django/apache2"

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule python_module modules/mod_python.so
LoadModule rewrite_module modules/mod_rewrite.so

KeepAlive Off
Listen 6594
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" combined
CustomLog logs/access_log combined
ServerLimit 2

<VirtualHost *:6594>
	ServerName ofri.webfactional.com
	ServerAdmin ofri.raviv at gmail.com
	DocumentRoot /home/ofri/webapps/django/knesset_svn/knesset
	<Location "/">
    		PythonHandler django.core.handlers.modpython
    		PythonPath "['/home/ofri/webapps/django','/home/ofri/webapps/
django/knesset_svn','/home/ofri/webapps/django/knesset_svn/knesset','/
home/ofri/webapps/django/lib/python2.5'] + sys.path"
		PythonOption django.root /knesset

    		SetEnv DJANGO_SETTINGS_MODULE knesset.settings
    		SetHandler python-program
	</Location>
</VirtualHost>


On Jul 30, 8:36 am, Saffi <saff... at gmail.com> wrote:
> We don't have admin ... we don't have db.
>
> On Wed, Jul 29, 2009 at 11:48 AM, ofri <ofri.ra... 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