- add cache

- add github issue support
This commit is contained in:
Nils Büchner 2024-04-01 22:27:00 +02:00
parent cf30559c26
commit 89fa95f931
4 changed files with 11 additions and 2 deletions

View file

@ -3,4 +3,4 @@ from django.apps import AppConfig
class FactoidsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'factoids'
name = 'factoids'

View file

@ -1,6 +1,8 @@
from django.http import HttpResponse, Http404
from rest_framework.views import APIView
from rest_framework.decorators import api_view
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework.response import Response
from .models import Fact
from .serializers import FactSerializer

View file

@ -15,7 +15,6 @@ from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
@ -25,6 +24,13 @@ SECRET_KEY = 'aekeijahsheik8AhghaiDie5awuen3ahvaeHeeyirahsaic4einaePeiyoophahd'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'cache',
}
}
ALLOWED_HOSTS = ['*']
REST_FRAMEWORK = {

View file

@ -4,6 +4,7 @@ from django.shortcuts import redirect
urlpatterns = [
path("factoids/", include("factoids.urls")),
path("bugtracker/", include("bugtracker.urls")),
path("admin/", admin.site.urls),
path('', lambda request: redirect('factoids/', permanent=False)), # Redirect from root to 'factoids'
]