Re: How to get site's root path in Django
On 28 oct, 07:38, "yuanyun.ken" <[EMAIL PROTECTED]> wrote: > Steve, Thanks for your expeditious reply. > because our apache server includes other apps, I can not deploy my app > to the root of the server. This won't fix http://code.djangoproject.com/ticket/8906, but there's at least one possible workaround in the meantime : use a sub domain (ie subdomain.yourdomain.tld). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to get site's root path in Django
hi, Karen, Thanks for your reply. I am sure I hit that problem, http://code.djangoproject.com/ticket/8906 and I wish some excellent gays have time to investigate, and provide a fix. For now, I would just include root path in LOGIN_URL and LOGOUT_URL variable. On Oct 29, 12:46 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > > Sounds like: > > http://code.djangoproject.com/ticket/8906 > > So (assuming you are not "levity") someone else has reported the same > thing. It sounds like there may be a problem in Django code here, but no > one has yet investigated far enough to confirm that or suggest a fix. > > Karen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to get site's root path in Django
On Tue, Oct 28, 2008 at 11:10 AM, yuanyun.ken <[EMAIL PROTECTED]> wrote: > > Graham, thanks for your kindly help. > > I know we don't need root url when configure url mapping. but it seems > that LOGIN_URL is somewhat special. > > When I set LOGIN_URL = '/login/' > accessing http://localhost/root_url/login/ is ok, > but when I access some pages which need login first, I will got 404 > error, and in apache's error log, it logs: > File does not exist: D:/Program Files/Apache Software Foundation/ > Apache2.2.9/htdocs/login > > and the only way to work is adding root url to LOGIN_URL. > LOGIN_URL = '/root_url/login/' > > I can not figure out whether there are problems in my configuration, > or anything else. > Sounds like: http://code.djangoproject.com/ticket/8906 So (assuming you are not "levity") someone else has reported the same thing. It sounds like there may be a problem in Django code here, but no one has yet investigated far enough to confirm that or suggest a fix. Karen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to get site's root path in Django
Graham, thanks for your kindly help. I know we don't need root url when configure url mapping. but it seems that LOGIN_URL is somewhat special. When I set LOGIN_URL = '/login/' accessing http://localhost/root_url/login/ is ok, but when I access some pages which need login first, I will got 404 error, and in apache's error log, it logs: File does not exist: D:/Program Files/Apache Software Foundation/ Apache2.2.9/htdocs/login and the only way to work is adding root url to LOGIN_URL. LOGIN_URL = '/root_url/login/' I can not figure out whether there are problems in my configuration, or anything else. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to get site's root path in Django
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/ > > 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 > > > 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 -~--~~~~--~~--~--~---
Re: How to get site's root path in Django
Steve, Thanks for your expeditious reply. because our apache server includes other apps, I can not deploy my app to the root of the server. and I am sure, many Django apps are not deployed to server's root too. so there must be a way to handle this problem. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to get site's root path in Django
yuanyun.ken 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. > > But in Django your project's root URL is "/", which is why the default settings.LOGIN_URL is "/accounts/login/". > I tried to use: > LOGIN_URL = '/login/' > or > LOGIN_URL = 'login/' > > the first can not work, apache would try to access http://localhost/login/, > not http://localhost/root_url/login/ > So what you are saying is that you aren't running Django mapped to the root of your server's web address space? > the second option would not work, when access > http://localhost/root_url/dira/pageb, > this would lead to access http://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/ > > 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 > > > Any help is appreciated, and Thanks in advance. If you don't want Django at the root of your web space then you will have to take special pains to remap it. What's the reason you want your project to appear at "/root_url/" rather than "/"? regards Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to get site's root path in Django
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 access http://localhost/login/, not http://localhost/root_url/login/ the second option would not work, when access http://localhost/root_url/dira/pageb, this would lead to access http://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/ 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 Any help is appreciated, and Thanks in advance. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---