diff options
| author | Caine <caine@jihakuz.xyz> | 2026-04-02 16:33:31 +0100 |
|---|---|---|
| committer | Caine <caine@jihakuz.xyz> | 2026-04-02 16:33:31 +0100 |
| commit | fe00286f7558d379d392f8a46d10a4689f95d472 (patch) | |
| tree | 23a27fc7b8c97b56e30d9a7bd9135a921be83209 /food_project | |
| parent | 487bf469795d70fb2bfdbee882d00f0c5e726a9a (diff) | |
Add API: URLs, token auth, what-can-i-cook endpoint, log-cook with pantry deduction, browsable API
Diffstat (limited to 'food_project')
| -rw-r--r-- | food_project/settings.py | 12 | ||||
| -rw-r--r-- | food_project/urls.py | 4 |
2 files changed, 15 insertions, 1 deletions
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', diff --git a/food_project/urls.py b/food_project/urls.py index ab55255..8acbe51 100644 --- a/food_project/urls.py +++ b/food_project/urls.py @@ -15,8 +15,10 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), + path('api/', include('kitchen.urls')), + path('api-auth/', include('rest_framework.urls')), # browsable API login ] |
