> I'm trying to set up my site on a university webspace, so the root is
> a subdirectory, ie www.university.edu/~mysite/. Because of this, I'm
> having trouble logging into the admin pages. I go to 
> www.university.edu/~mysite/admin/
> and get the login page, but when I try to login, it goes to
> www.university.edu/admin/ because the form posts to the relatvie url /
> admin/. Any ideas how to fix this? Anyone else have this problem?

Not a problem to me really, as here's how I fixed it:

urls.py:

from django.conf.urls.defaults import *
from django.conf import settings
import sys

if 'runserver' in sys.argv:
     urlpatterns = patterns('',
         # special URLs
         (r'^mysitemedia/(?P<path>.*)$', 'django.views.static.serve',
          {'document_root': settings.MEDIA_ROOT}),  # This may have to  
be different, eg '^~mysite/media/' or so (but be careful the admin and  
your own media don't clash).

         # normal URLs
         url(r'^~mysite/', include('mysite.mysiteurls')),   # Here, I  
pick out the base url
                            )
else:
     urlpatterns = patterns('', url(r'^~mysite/',  
include('mysite.mysiteurls')),)


and mysiteurls.py:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
# special URLs
     (r'^admin/', include('django.contrib.admin.urls')),

# normal URLs
     url(r'^users/', include('mysite.users.urls')),
     .
     .
     .
     url(r'^', include('mysite.main.urls')),
)

Lastly, in settings.py, I have defined a ROOT_URL and some  
redefinitions for the user stuff:
ROOT_URL = '/~mysite/'
LOGIN_URL = ROOT_URL + 'users/login/'
LOGOUT_URL = ROOT_URL + 'users/logout/'
LOGIN_REDIRECT_URL = ROOT_URL + 'users/profile/'


Note: I have put '~mysite' in various places, but since I actually  
simply use 'mysite', I may have done some incorrect substitutions. So  
do doublecheck.
But in principal this should work, and with the proper setup for the  
media, you can use the same url configuration for a development and  
production server.












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