Reverse failing (NoReverseMatch) for newly added apphooks
See original GitHub issueSteps
Add an apphook to a (published) Django-CMS page. The application is added only once. The model of that application uses reverse()
for its get_absolute_url()
override.
Expecting
Should work, and it works after restarting the server that was started in via runserver
Actual
When running LiveServerTestCase
that import those pages via fixtures, or when adding the apphook the first time and before restarting the server, it’ll fail on page load (the actual page calling reverse) with:
NoReverseMatch: Reverse for 'XXX' with arguments '('123')' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Environment
- Linux
- django-cms==3.0.1
- Django==1.6.4
catalog/cms_app.py
class CatalogApphook(CMSApp):
name = _("XXX")
urls = ["catalog.urls"]
apphook_pool.register(CatalogApphook)
catalog/url.py
from django.conf.urls import url, patterns
urlpatterns = patterns('catalog.views',
url(r'^([\w-]{1,40})/$', 'catalog'),
)
url.py
urlpatterns = i18n_patterns('',
url(r'^accounts/login/$', login),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
) + static(
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
)
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Reverse failing (NoReverseMatch) for newly added apphooks
Steps Add an apphook to a (published) Django-CMS page. The application is added only once. The model of that application uses reverse() for ......
Read more >NoReverseMatch at / Reverse for 'product_list_by_category ...
Everytime I run my django project, I get this error NoReverseMatch at / Reverse for 'product_list_by_category' with keyword arguments ...
Read more >NoReverseMatch at / Reverse for 'submit' with arguments ...
I have been getting this NoReverseMatch error or I cannot properly process the POST data. I am new with Django so I have...
Read more >Complex apphook configuration - django CMS documentation
It provides the fallback namespace for views and templates that reverse URLs. ... If they don't, your pages using them will throw up...
Read more >How to create apphooks — django cms 3.10.0 documentation
If you fail to do this, then any templates in the application that invoke URLs using the form {% url 'myapp:index' %} or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I saw a similar page but saying “When you run manage.py runserver a restart should not be needed.” at http://django-cms.readthedocs.org/en/3.0.1/extending_cms/app_integration.html#automatically-restart-server-on-apphook-changes
Thanks for the feedback, I’ll try those functions. There are
clear_app_resolvers()
andclear_url_caches()
calls all over the place; It would be good to simplify this by one of:Thanks. Actually both looked kind of related but the second is really what I want.