On 07/29/2009 11:51 PM, ofri wrote: > just tried it, and it doesn't seem to work. > > you can view it at http://ofri.webfaction.com/knesset/admin/ > it will give you the login form. but view the source, and check where > the form posts to: > <form action="/admin/" method="post" id="login-form"> > try to submit anything. you'll get a '405 Not Allowed'. > > my httpd.conf has > ... > <Location "/"> > ... > PythonOption django.root /knesset > ... > </Location> > > and my urls.py has this (r'^admin/(.*)', admin.site.root) in > urlpatterns. >
IIRC you hade Location "/knesset" in your httpd conf, and it should go there, otherwise it won't catch on, as obvious from your result. Django uses django.root regardeless of <Location> (at least from reading the code of mod_python handler). > I suspect that in their example, they are using<location "/mysite/"> > and *that's why* admin posts to /mysite/admin/, and not because of > django.root > It's not just their example, it's working on my servers as well. Can you post your entire apache config ? Cheers -- Meir Kriheli > > On Jul 29, 2:44 pm, Meir Kriheli<[email protected]> wrote: >> 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:http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ >> >> and the mod_python >> handler:http://code.djangoproject.com/browser/django/trunk/django/core/handle... >> >> P.S. >> IMO A solid net connection is essential for future meetings. >> >> P.P.S >> It was fun. >> >> Cheers >> -- >> Meir Kriheli >> >> >> >>> On Jul 28, 1:17 pm, Saffi<[email protected]> 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 > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "PyWeb-IL" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyweb-il?hl=en -~----------~----~----~----~------~----~------~--~--- _______________________________________________ Python-il mailing list [email protected] http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
