From aa8333cd649545c7ad81ad0c8fea33daeda655e3 Mon Sep 17 00:00:00 2001 From: Jonas Legion Date: Fri, 11 Jun 2021 18:18:00 +0200 Subject: [PATCH] Djoser simple install --- DjangoFiles/TiBillet/settings.py | 15 +++++++++++++++ DjangoFiles/TiBillet/urls_public.py | 2 ++ DjangoFiles/TiBillet/urls_tenants.py | 4 ++++ Docker/Dockerfile/dockerfile | 7 +++++-- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/DjangoFiles/TiBillet/settings.py b/DjangoFiles/TiBillet/settings.py index 3132f47..9065590 100644 --- a/DjangoFiles/TiBillet/settings.py +++ b/DjangoFiles/TiBillet/settings.py @@ -42,6 +42,10 @@ SHARED_APPS = ( # everything below here is optional 'django.contrib.auth', + 'rest_framework', + 'rest_framework.authtoken', + 'djoser', + 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', @@ -133,6 +137,17 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] +REST_FRAMEWORK = { + "DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",), + "DEFAULT_AUTHENTICATION_CLASSES": ( + "rest_framework_simplejwt.authentication.JWTAuthentication", + "rest_framework.authentication.TokenAuthentication", + ), +} + +SIMPLE_JWT = { + 'AUTH_HEADER_TYPES': ('JWT',), +} # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ diff --git a/DjangoFiles/TiBillet/urls_public.py b/DjangoFiles/TiBillet/urls_public.py index 74bf344..a7e46cb 100644 --- a/DjangoFiles/TiBillet/urls_public.py +++ b/DjangoFiles/TiBillet/urls_public.py @@ -22,6 +22,8 @@ urlpatterns = [ path('jet/', include('jet.urls', 'jet')), # Django JET URLS re_path(r'^jet/dashboard/', include('jet.dashboard.urls', 'jet-dashboard')), # Django JET dashboard URLS path('admin/', public_admin_site.urls, name="public_admin_url"), + re_path(r'^auth/', include('djoser.urls')), + path('', include('MetaBillet.urls')), # path('admin/', admin.site.urls, name="public_admin_url"), ] diff --git a/DjangoFiles/TiBillet/urls_tenants.py b/DjangoFiles/TiBillet/urls_tenants.py index 5d8e88b..f6848ef 100644 --- a/DjangoFiles/TiBillet/urls_tenants.py +++ b/DjangoFiles/TiBillet/urls_tenants.py @@ -23,6 +23,10 @@ urlpatterns = [ path('jet/', include('jet.urls', 'jet')), # Django JET URLS re_path(r'^jet/dashboard/', include('jet.dashboard.urls', 'jet-dashboard')), # Django JET dashboard URLS path('admin/', admin.site.urls, name="public_admin_url"), + + re_path(r'^auth/', include('djoser.urls')), + re_path(r'^auth/', include('djoser.urls.authtoken')), + path('', include('BaseBillet.urls')), # path('admin/', admin.site.urls, name="public_admin_url"), diff --git a/Docker/Dockerfile/dockerfile b/Docker/Dockerfile/dockerfile index 544695c..b1500c2 100644 --- a/Docker/Dockerfile/dockerfile +++ b/Docker/Dockerfile/dockerfile @@ -23,6 +23,10 @@ RUN pip install django-tenants RUN pip install mollie-api-python RUN pip install markdown # Markdown support for the browsable API. RUN pip install django-filter # Filtering support +RUN pip install djoser +RUN pip install djangorestframework_simplejwt +RUN pip install social-auth-app-django + ## PYTHON FOR DEV RUN pip install ipython @@ -50,8 +54,7 @@ RUN apt-get install -y --no-install-recommends postgresql-client # RUN pip install django-stdimage # RUN pip install django-crispy-forms # RUN pip install reportlab -# RUN pip install -U djoser -# RUN pip install -U djangorestframework_simplejwt + # RUN pip install -U social-auth-app-django # RUN pip install -U django-templated-mail