mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Added simple health check
This commit is contained in:
9
src/pretix/base/views/health.py
Normal file
9
src/pretix/base/views/health.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
from ..models import User
|
||||||
|
|
||||||
|
|
||||||
|
def healthcheck(request):
|
||||||
|
# Perform a simple DB query to see that DB access works
|
||||||
|
User.objects.exists()
|
||||||
|
return HttpResponse()
|
||||||
@@ -8,7 +8,7 @@ from django.views.i18n import javascript_catalog
|
|||||||
import pretix.control.urls
|
import pretix.control.urls
|
||||||
import pretix.presale.urls
|
import pretix.presale.urls
|
||||||
|
|
||||||
from .base.views import cachedfiles
|
from .base.views import cachedfiles, health
|
||||||
|
|
||||||
# This is not a valid Django URL configuration, as the final
|
# This is not a valid Django URL configuration, as the final
|
||||||
# configuration is done by the pretix.multidomain package.
|
# configuration is done by the pretix.multidomain package.
|
||||||
@@ -23,6 +23,8 @@ import_date = timezone.now().strftime("%Y%m%d%H%M")
|
|||||||
base_patterns = [
|
base_patterns = [
|
||||||
url(r'^download/(?P<id>[^/]+)/$', cachedfiles.DownloadView.as_view(),
|
url(r'^download/(?P<id>[^/]+)/$', cachedfiles.DownloadView.as_view(),
|
||||||
name='cachedfile.download'),
|
name='cachedfile.download'),
|
||||||
|
url(r'^healthcheck/$', health.healthcheck,
|
||||||
|
name='cachedfile.download'),
|
||||||
url(r'^jsi18n/$',
|
url(r'^jsi18n/$',
|
||||||
etag(lambda *s, **k: import_date)(cache_page(3600, key_prefix='js18n-%s' % import_date)(javascript_catalog)),
|
etag(lambda *s, **k: import_date)(cache_page(3600, key_prefix='js18n-%s' % import_date)(javascript_catalog)),
|
||||||
js_info_dict, name='javascript-catalog'),
|
js_info_dict, name='javascript-catalog'),
|
||||||
|
|||||||
Reference in New Issue
Block a user