2

这是我的设置 .py

CMS_LANGUAGE_CONF = { 
    'en':['es'], 
    'es':['en'], 
} 

CMS_SITE_LANGUAGES = { 
    1:['en','es'], 
} 
CMS_LANGUAGES = (
    ('es', gettext('Spanish')),
    ('en', gettext('English')),
)
CMS_HIDE_UNTRANSLATED = True
LANGUAGES = [('es', 'Spanish'),('en', 'English')]
DEFAULT_LANGUAGE = 1

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'cms.middleware.page.CurrentPageMiddleware',
    'cms.middleware.user.CurrentUserMiddleware',
    'cms.middleware.toolbar.ToolbarMiddleware',
     # 'django.middleware.locale.LocaleMiddleware',
    'cms.middleware.multilingual.MultilingualURLMiddleware',
    # 'vclubcms.middleware.URLMiddlewares.CustomMultilingualURLMiddleware'
)

我的问题是:

当我访问 myserver:8000/myview 它呈现。当我访问 myserver:8000/cmspage 它呈现在 cms 页面模板上时,我有一些链接。/language_code/cmspage由于多语言而被转换为。所以当点击链接时它没有打开。

例如myserver:8000/language_code/cmspage 不工作

我尝试了什么,我点击了这个链接 http://ilian.ini.org/language-redirects-for-multilingual-sites-with-django-cms/comment-page-1/

并启用

'vclubcms.middleware.URLMiddlewares.CustomMultilingualURLMiddleware'

然后我运行 myserver:8000/language_code/cmspage

表明

The page isn't redirecting properly

并有 21 个请求。

请建议我该如何解决这个问题。

4

0 回答 0