Load signal handlers from an app instead of urllist

This is the place to load them to make sure they always load. This means
we can also now remove a hardcoded special varnish purging in the CVE
crawler script, because all saves including those from cron jobs will
now fire the signals and thus the automatic varnish purges.
This commit is contained in:
Magnus Hagander
2020-06-14 17:44:31 +02:00
parent 95e4ef533d
commit 7f8a0a56dd
4 changed files with 11 additions and 7 deletions

10
pgweb/core/apps.py Normal file
View File

@ -0,0 +1,10 @@
from django.apps import AppConfig, apps
class CoreAppConfig(AppConfig):
name = 'pgweb.core'
def ready(self):
from pgweb.util.signals import register_basic_signal_handlers
register_basic_signal_handlers()

View File

@ -39,4 +39,3 @@ and have been made visible on the website.
{0}
""".format("\n".join(newly_visible)))
list(map(varnish_purge, SecurityPatch.purge_urls))

View File

@ -96,7 +96,7 @@ INSTALLED_APPS = [
'django.contrib.admin',
'django_markwhat',
'django.contrib.staticfiles',
'pgweb.core',
'pgweb.core.apps.CoreAppConfig',
'pgweb.mailqueue',
'pgweb.account',
'pgweb.news',

View File

@ -1,8 +1,6 @@
from django.conf.urls import include, url
from django.views.generic import RedirectView
from pgweb.util.signals import register_basic_signal_handlers
import pgweb.contributors.views
import pgweb.core.views
import pgweb.docs.views
@ -28,9 +26,6 @@ from pgweb.events.feeds import EventFeed
from django.contrib import admin
admin.autodiscover()
# Register our save signal handlers
register_basic_signal_handlers()
urlpatterns = [
url(r'^$', pgweb.core.views.home),
url(r'^dyncss/(?P<css>base|docs).css$', pgweb.core.views.dynamic_css),