问题描述
我已经按照进行操作新的Django-CMS(2.4)网站。我只使用单一语言(英语)。
I have followed the tutorial to make a new Django-CMS (2.4) site. I am only using a single language (English).
有一个自动重定向,在我的网站的URL中包含语言标识符'/ en /'。如何删除?
There is an automatic redirect to include the language identifier '/en/' in my site's URLs. How do I remove it?
谢谢。
推荐答案
模式注册:
urlpatterns = i18n_patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
)
与此相关:
from django.conf.urls import patterns
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
)
您指出的教程使用 i18n_patterns
方法,正是这样做:将语言代码添加到您的网址。
The tutorial you pointed to uses the i18n_patterns
method which does exactly this: prepends the language code to your urls.
另请注意,如果不使用多种语言,您可以从MIDDLEWARE_CLASSES安全地删除django.middleware.locale.LocaleMiddleware和cms.middleware.language.LanguageCookieMiddleware 。
Also note you can safely remove 'django.middleware.locale.LocaleMiddleware' and 'cms.middleware.language.LanguageCookieMiddleware' from your MIDDLEWARE_CLASSES if you will not use multiple languages.
这篇关于如何从django-cms 2.4网址中删除语言标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!