I have 2 sites, both require login ( I'm using the django provided django.contrib.auth.views.login). When I enter http:// url /siteb , I am redirected to accounts/login and siteb is taken out of the URL creating http:// url /accounts/login. But then I get an error "The requested URL /accounts/login w开发者_开发知识库as not found on server"
If I remove the login requirement and go directly to a page I can click around the site without problem (http:// url /siteb/faqa) If I have only one site in apache and use < Location "/" > I don't have a problem logging in and navigating. My issue is when I have 2 sites, both with the login redirect
(Django 1.2.1, Apache 2.2.14, Python 2.6, mod_python just because that's what I was told to use)
< VirtualHost *>
ServerName name DocumentRoot /etc/sites < Location "/siteb"> SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/etc/sites', '/etc/sites/siteb'] + sys.path" PythonOption django.root /siteb SetEnv DJANGO_SETTINGS_MODULE siteb.settings PythonInterpreter siteb PythonDebug on < /Location> < Location "/sitea"> SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/etc/sites', '/etc/sites/sitea'] + sys.path" PythonOption django.root /sitea SetEnv DJANGO_SETTINGS_MODULE sitea.settings PythonInterpreter sitea PythonDebug on < /Location>
< /VirtualHost>
All of the urls should be prefixed with /sitea/ or /siteb/
Django generally assumes that it is installed at the root of the website.
精彩评论