WSGIScriptAlias& DjangoCMS url重写

时间:2013-06-11 10:06:45

标签: python django apache url-rewriting django-cms

我的VM上有一个django cms站点和一个wordpress。 要转到wordpress站点:xx.xx.xx.xx / wordpress,这可以正常工作,这要归功于别名。
要访问djangoCMS站点:xx.xx.xx.xx / djangocms

在这里,djangocms重写网址:
XX.XX.XX.XX / EN / djangocms
我想要:xx.xx.xx.xx / djangocms / en /

这是我的apache conf:

WSGIScriptAlias /djangocms "/var/www/djangocms/apache/django.wsgi"
<Directory "/var/www/djangocms/">
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>

Alias /wordpress "/var/www/wordpress/"

my urls.py:

from django.conf.urls.defaults import *
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf import settings

admin.autodiscover()

urlpatterns = i18n_patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('cms.urls')),
)

if settings.DEBUG:
    urlpatterns = patterns('',
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
    url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns

#my django.wsgi
import os
import sys

os.environ['HTTPS'] = "on"
path = '/var/www/djangocms/'
if path not in sys.path:
    sys.path.insert(0, '/var/www/djangocms/')

os.environ['DJANGO_SETTINGS_MODULE'] = 'djangocms.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

任何人都知道如何添加/ en / after / djangocms /? 谢谢;)

1 个答案:

答案 0 :(得分:0)

解决:

Redirect /en/django /django/en