我正在用django cms开发一个django网站,我想将django cms放在一个虚拟目录中,即我的主网站在:
本地主机:8000 / [页]
我希望django cms web in:
本地主机:8000 / virtualdirectoryname /郎/ [页]
因此,我尝试使用两个文件配置urls.py:
urls_cms.py:
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.contrib import admin
urlpatterns = i18n_patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
和urls.py:
from django.conf.urls import include, url
urlpatterns = [
url(r'^virtualdirectoryname/', include('project.urls_cms')),
#... Definition of more urls from my main page
]
当我这样做时,我收到了错误:
不允许在包含的URLconf中使用i18n_patterns
那么,我怎样才能实现目标呢?
谢谢!