我正在尝试在现有项目中使用Django-CMS。我阅读了文档(http://docs.django-cms.org/en/latest/how_to/install.html和http://docs.django-cms.org/en/latest/how_to/apphooks.html),并尝试使用django-cms: urls used by apphooks don't work with reverse() or {% url %}解决我的问题,但是这些都没有帮助我。
问题:
我无法撤消任何网址。当我尝试扭转某些东西时,出现此错误:
django.urls.exceptions.NoReverseMatch: 'poll' is not a registered namespace
这是我的cms_apps.py:
@apphook_pool.register
class PollApp(CMSApp):
name = "Umfragen"
app_name = "poll"
urls = ["apps.poll.urls"]
poll / urls.py:
app_name = "poll"
urlpatterns = [
# Some other paths
path('', views.search, name="search"),
]
这是我尝试过的:
{% url 'poll:search' %}
reverse("poll:search")
reverse("de:poll:search")
reverse("cms:poll:search")