On Oct 28, 2:24 am, "yuanyun.ken" <[EMAIL PROTECTED]> wrote:
> Hi, all great Django users and developers, I have a little problem.
> To make @login_required work,
> I have to configure those in settings.py:
> root_url = '/root_url/'
> LOGIN_URL = root_url + '/login/'
> LOGOUT_URL =  root_url + '/logout/'
>
> But this is obviously not a good idea, as it couples with project's
> root url.
>
> I tried to use:
> LOGIN_URL = '/login/'
> or
> LOGIN_URL = 'login/'
>
> the first can not work, apache would try to accesshttp://localhost/login/,
> nothttp://localhost/root_url/login/
> the second option would not work, when 
> accesshttp://localhost/root_url/dira/pageb,
> this would lead to accesshttp://localhost/root_url/dira/login
>
> urls.py
> (r'^login/$', 'django.contrib.auth.views.login'),
> (r'^logout/$', 'django.contrib.auth.views.logout')
>
> The following are my configuration in apache's httpd.conf
> Alias /root_url/ D:/ws/django/myproject/
> <Location '/root_url/'>
>     SetHandler python-program
>     PythonHandler django.core.handlers.modpython
>     SetEnv DJANGO_SETTINGS_MODULE Regrroot_url.settings
>     PythonOption django.root /root_url
>     PythonDebug On
>     PythonPath "['D:/ws/django/myproject/'] + sys.path"
> Options ExecCGI
> Options +Indexes
> Order allow,deny
> Allow from all
> </Location>
>
> Any help is appreciated, and Thanks in advance.

When mounting at sub URL of a site, you shouldn't be adding the mount
point into anything in settings or in urls.py. For mod_python, the
only point you should need to added it is the PythonOption setting for
django.root. Thus, your settings for LOGIN_URL and LOGOUT_URL were
wrong when you were including root url in them.

Do note though that mounting at a sub URL possibly only works properly
if using Django 1.0, so make sure you aren't using an older version of
Django.

Graham

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to