From fe00286f7558d379d392f8a46d10a4689f95d472 Mon Sep 17 00:00:00 2001 From: Caine Date: Thu, 2 Apr 2026 16:33:31 +0100 Subject: Add API: URLs, token auth, what-can-i-cook endpoint, log-cook with pantry deduction, browsable API --- food_project/settings.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'food_project/settings.py') diff --git a/food_project/settings.py b/food_project/settings.py index 43a0ede..5e3dcee 100644 --- a/food_project/settings.py +++ b/food_project/settings.py @@ -38,9 +38,21 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', + 'rest_framework.authtoken', 'kitchen', ] +# Django REST Framework +REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': [ + 'rest_framework.authentication.TokenAuthentication', + 'rest_framework.authentication.SessionAuthentication', # for admin/browsable API + ], + 'DEFAULT_PERMISSION_CLASSES': [ + 'rest_framework.permissions.IsAuthenticated', + ], +} + MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', -- cgit v1.2.3