1
0
Fork 0
mirror of https://github.com/Findus23/RPGnotes.git synced 2024-09-19 15:43:45 +02:00
RPGnotes/common/views.py

41 lines
1.1 KiB
Python
Raw Normal View History

2021-08-22 20:10:29 +02:00
from django.http import HttpResponse
2021-09-11 19:09:22 +02:00
from django.shortcuts import render
2021-09-14 17:32:51 +02:00
from django.views.generic import TemplateView
2021-09-24 18:36:51 +02:00
from ipware import get_client_ip
2021-09-11 19:09:22 +02:00
from sentry_sdk import last_event_id
2021-08-22 20:10:29 +02:00
2021-09-11 19:09:22 +02:00
from rpg_notes.secrets import SENTRY_DSN
2021-08-29 22:09:22 +02:00
from utils.assets import get_css
2021-08-22 20:10:29 +02:00
2021-09-11 19:09:22 +02:00
2021-09-14 17:32:51 +02:00
class PublicHomepageView(TemplateView):
2021-10-15 20:10:50 +02:00
template_name = "common/homepage.jinja"
2021-09-14 17:32:51 +02:00
class LanguageSelectView(TemplateView):
template_name = "common/languageselect.html"
2021-09-24 18:36:51 +02:00
def print_ip(request):
client_ip, is_routable = get_client_ip(request)
2021-09-24 18:41:30 +02:00
return HttpResponse(repr(client_ip), content_type="text/plain")
2021-09-24 18:36:51 +02:00
2021-09-07 17:05:03 +02:00
# @cache_page(60 * 15)
2021-08-22 20:10:29 +02:00
def debug_css(request):
css, source_map = get_css(debug=True)
return HttpResponse(css, content_type="text/css")
2021-09-11 19:09:22 +02:00
2021-09-07 17:05:03 +02:00
# @cache_page(60 * 15)
2021-08-22 20:10:29 +02:00
def debug_css_sourcemap(request):
css, source_map = get_css(debug=True)
return HttpResponse(source_map, content_type="application/json")
2021-09-11 19:09:22 +02:00
def handler500(request, *args, **argv):
return render(request, "500.html", {
"sentry_event_id": last_event_id(),
"sentry_dsn": SENTRY_DSN
}, status=500)