简体   繁体   English

如何从地址中删除语言?

[英]How to remove language from the address?

Please help me to solve this problem. 请帮我解决这个问题。

I installed Django-cms, I plan to do a monolingual site. 我安装了Django-cms,我打算做一个双语网站。 When installing I still need to enter a language code. 安装时,我仍然需要输入语言代码。 I introduced the RU. 我介绍了RU。

The problem is that when loading any page it adds the following to the web address 问题是,在加载任何页面时,它将以下内容添加到网址中

/ru/ 

I need an address which isn't in the language code 我需要一个不在语言代码中的地址

Original answer from @ppetrid in How to remove the language identifier from django-cms 2.4 URLs? @ppetrid中的原始答案, 如何从django-cms 2.4 URL中删除语言标识符?

I know django-cms is already 3.x version but it should work, 我知道django-cms已经是3.x版本,但应该可以使用,

replace this pattern registration: 替换此模式注册:

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

with this: 有了这个:

from django.conf.urls import patterns

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM