Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django Django cms反向';NoReverseMatch位于..';多站点语言_Python_Django_Django Cms - Fatal编程技术网

Python Django Django cms反向';NoReverseMatch位于..';多站点语言

Python Django Django cms反向';NoReverseMatch位于..';多站点语言,python,django,django-cms,Python,Django,Django Cms,这似乎是一个“经典”问题: NoReverseMatch at/tr/展厅/ 未找到参数为“()”且关键字参数为“{}”的“项目列表”的反转。已尝试0个模式:[] 但问题是,当我在互联网上查看不同的主题,然后查看我的文件时,我没有得到它 所以它在母语上工作得很好。仅当我尝试更改此展厅页面上的语言时,才会发生这种情况。 除了这一页外,使用commad cms复制的每一页都可以正常工作 好的,这是模型: def get_slug(self): return self.safe_tra

这似乎是一个“经典”问题:

NoReverseMatch at/tr/展厅/ 未找到参数为“()”且关键字参数为“{}”的“项目列表”的反转。已尝试0个模式:[]

但问题是,当我在互联网上查看不同的主题,然后查看我的文件时,我没有得到它

所以它在母语上工作得很好。仅当我尝试更改此展厅页面上的语言时,才会发生这种情况。 除了这一页外,使用commad cms复制的每一页都可以正常工作

好的,这是模型:

    def get_slug(self):
    return self.safe_translation_getter(
        'slug',
        language_code=get_language(),
        any_language=False)

def get_absolute_url(self, current_app=None):
    """
    Warning: Due to the use of django application instance namespace
    (for handle multi instance of an application)we add the possibility
    to use it with the reverse.
    So if get_absolute_url is call without app instance it may failed (
    for example in django_admin)
    """
    lang = get_language()
    if self.has_translation(lang):
        kwargs = {'slug': self.get_slug()}
        return reverse('djangocms_showroom:project-detail',
                       kwargs=kwargs,
                       current_app=current_app)
    return reverse('djangocms_showroom:project-list', current_app=current_app)

def get_full_url(self, site_id=None):
    return self._make_full_url(self.get_absolute_url(), site_id)

def _make_full_url(self, url, site_id=None):
    if site_id is None:
        site = Site.objects.get_current()
    else:
        site = Site.objects.get(pk=site_id)

    return get_full_url(url, site)
网址:

from django.conf.urls import patterns, url

from .views import (ProjectListView, ProjectDetailView)


urlpatterns = patterns(
    '',
    url(r'^$', ProjectListView.as_view(), name='project-list'),
    url(r'^project/(?P<slug>\w[-\w]*)/$', ProjectDetailView.as_view(), name='project-detail'),
)
来自django.conf.url导入模式,url
from.views导入(ProjectListView、ProjectDetailView)
urlpatterns=模式(
'',
url(r'^$',ProjectListView.as_view(),name='project-list'),
url(r“^project/(?P\w[-\w]*)/$”,ProjectDetailView.as_view(),name='project-detail'),
)
以及html错误:

模板呈现期间出错

在template/var/www/webapps/blippar_网站/app/blippar/templates/djangocms_展厅/project_list.html中,第14行出现错误

即:

<form id="projects-filter" action="{% url 'djangocms_showroom:project-list' %}">


嗯,我还不太擅长django和django cms,如果有人有任何线索,那将是了不起的

错误信息很清楚,模板项目中的第14行出错\u list.html哪一行是第14行?从您显示的URL模式来看,没有匹配的正则表达式
/tr/…
您能显示正确的URL模式吗?是的,这是插件的URL模式。必须由django cms管理
/en/
/tr/
/es/
。当我写
url时(r'^$'..
-它的意思是
https://domain.com/lang/
错误消息很清楚,模板项目的第14行出错\u list.html哪一行是第14行?从您显示的URL模式来看,没有匹配的正则表达式
/tr/…
您能显示正确的URL模式吗?是的,这是插件的URL模式r
/tr/
/es/
必须由django cms管理。当我编写
url(r'^$'.
)时,它意味着
https://domain.com/lang/