Search code examples
pythondjangodjango-cms

Django(-CMS) Userwarning: No registered apphook


I have a django website with some selfbuild applications, three in count.

Since I have updated to Django-CMS 3.4.3 and Django 1.9.11 (for aldryn newsblog) I get the following warning:

venv/lib/python2.7/site-packages/cms/apphook_pool.py:97: UserWarning: Kein registrierter apphook "u'AssociationAppApp'" gefunden
  warnings.warn(_('No registered apphook "%r" found') % app_name)

or in english (my own translation)

venv/lib/python2.7/site-packages/cms/apphook_pool.py:97: UserWarning: No registered apphook "u'AssociationAppApp'" found
  warnings.warn(_('No registered apphook "%r" found') % app_name)

I have a cms_app.py

from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _

from .menu import AssociationSubMenu


class AssociationApp(CMSApp):
    name = _('Associations')
    app_name = 'associations'

    def get_urls(self, page=None, language=None, **kwargs):
        print("called")
        return ['bbd.apps.associations.urls']

apphook_pool.register(AssociationApp)

my urls.py

from django.conf.urls import url

from .views import AssociationListView, AssociationDownloadListView, AssociationDetailContactView, AssociationEventListView


urlpatterns= [
    # List View
    url(r'^$', AssociationListView.as_view(), name="association_list"),
    # Contact View
    url(r'^(?P<slug>[^/]+)/kontakt$', AssociationDetailContactView.as_view(), name='association_contact'),
    # List association_events
    url(r'^(?P<slug>[^/]+)/veranstaltungen$', AssociationEventListView.as_view(), name='association_detail_events'),
    url(r'^(?P<slug>[^/]+)/downloads$', AssociationDownloadListView.as_view(), name='association_detail_downloads'),
    # Detail View
    url(r'^(?P<slug>[^/]+)', AssociationDetailContactView.as_view(), name='association_contact'),]

my projects urls.py

from django.contrib.sitemaps.views import sitemap

admin.autodiscover()

urlpatterns = staticfiles_urlpatterns()

urlpatterns += i18n_patterns(
    url(r'^admin/', include(admin.site.urls)),  # NOQA
    url(r'^sitemap\.xml$', sitemap,
        {'sitemaps': {'cmspages': CMSSitemap}}),
    url(r'^select2/', include('django_select2.urls')),
    url(r'^filebrowser_filer/', include('ckeditor_filebrowser_filer.urls')),
    url(r'^associations/', include('bbd.apps.associations.urls', namespace="associations"), name='associations'),
    url(r'^google986acbe70fc0baef\.html$', lambda r: HttpResponse("google-site-verification: google986acbe70fc0baef.html", mimetype="text/plain")),
    url(r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: ", mimetype="text/plain")),
    url(r'^', include('cms.urls'))
)

The App is in the INSTALL_APPS. My problem now is, that the App does not show up when I want to add it to a site. I have the strong feeling, that it has something todo with the warning above, which I get for all three apps (not mentioned in these files yet). The Problem persists when I remove the urls from the projects urls.py file. I have no idead how to debug this, so I need help.


Solution

  • Found it after reading through the update news. It's now cms_apps.py as filename, not cms_app.py