2

我的虚拟机上有一个 django cms 站点和一个 wordpress。要访问 wordpress 站点:xx.xx.xx.xx/wordpress,这很好,这要归功于别名。
访问 djangoCMS 站点:xx.xx.xx.xx/djangocms

在这里,djangocms 重写了 url:
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/"

我的 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()

有人知道如何在 /djangocms/ 之后添加 /en/ 吗?谢谢 ;)

4

1 回答 1

0

解决了:

Redirect /en/django /django/en
于 2013-06-24T09:48:15.510 回答