apache - Moving Django site to another server- WSGIScriptAlias causing problems -
i'm in process of moving django site on new server. on old server, django site accessed mysite.com/ , now, access via mysite.com/mysite, , let mysite.com handle else. have made following changes apache so:
wsgidaemonprocess mysite processes=2 threads=15 display-name=%{group} wsgiprocessgroup mysite wsgiscriptalias /mysite /srv/www/django.wsgi #wsgiscriptalias /mysite /srv/www/django.wsgi #previous config <directory /srv/www/mysite/mysite > order allow,deny allow </directory> alias /site_media "/srv/www/mysite/site_media/" alias /admin_media "/srv/www/mysite/admin_media/"
this seems work fine- pointing browser @ mysite.com/unity/admin allows me access admin page correctly, , view respective apps correct. however, uses custom template seems half-baked. instance, there's entry in template below so:
{% ifcodable cl.model %}<li><a href="/report/{{ app_label }}/{{ cl.opts.verbose_name }}" class="link">coding report</a></li>{% endifcodable %}
this redirect page
http://mysite.com/report/texas/texas
as opposed to
http://mysite.com/mysite/report/texas/texas
i'm not sure if template set incorrectly or if has new alias. urls.py looks so:
from django.conf.urls.defaults import * django.conf import settings django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ..... (r'^report/([a-za-z]+?)/([a-za-z]+?)/(overall|\d+)/{0,1}$', 'mysite.k.views.performance'), (r'^report/(.+?)/(.+?)/{0,1}$', 'mysite.k.views.report'), .....
my django.wsgi file looks so:
import os,sys sys.path.append('/srv/www/mysite') sys.path.append('/srv/www/mysite/mysite') sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..') os.environ['django_settings_module'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler()
i don't know proper thing correct problem. i'm new django, if there wicked simple solution apologize. advice appreciated!
the problem url begins /report
in href attribute. beginning /
means should relative root of domain. believe need change how django sites framework configured, , looks this question has answer.
also, should use url tag in templates instead of hardcoding urls in anchor tags.
Comments
Post a Comment