From beb75e9bd03540a35b1234eafadedb6adec321bd Mon Sep 17 00:00:00 2001 From: Costantino Vitale Date: Mon, 24 Oct 2022 09:17:01 +0200 Subject: [PATCH] - Update views --- sistema/views.py | 2 +- socoin_atlas/settings.py | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/sistema/views.py b/sistema/views.py index b6b60de..5bdc2ff 100644 --- a/sistema/views.py +++ b/sistema/views.py @@ -244,7 +244,7 @@ class PoiView(View):#PermissionRequiredMixin def post(self, request, *args, **kwargs): if 'mod' in request.POST: self.mod_poi(request) - elif 'add-multimedia'in request.POST: + elif 'add-multimedia' in request.POST: self.add_multimedia(request) else: self.add_poi(request) diff --git a/socoin_atlas/settings.py b/socoin_atlas/settings.py index f7d5f67..64a8646 100644 --- a/socoin_atlas/settings.py +++ b/socoin_atlas/settings.py @@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ - +import datetime import os from pathlib import Path @@ -26,7 +26,7 @@ SECRET_KEY = 'django-insecure-h&&@$m&_9g%%jj%yo0vlne*^2fld=-#9*uhm4snirl&w4!08bo # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition @@ -55,9 +55,21 @@ MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -AUTHENTICATION_BACKENDS = [ - "django.contrib.auth.backends.ModelBackend", -] +REST_FRAMEWORK = { + 'DEFAULT_PERMISSION_CLASSES' : ( + 'rest_framework.permissions.IsAuthenticated', + ), + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework_simplejwt.authentication.JWTAuthentication', + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.BasicAuthentication', + ), +} + +JWT_AUTH = { + 'JWT_ALLOW_REFRESH' : True, + 'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=3600), +} ROOT_URLCONF = 'socoin_atlas.urls' @@ -90,7 +102,7 @@ DATABASES = { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'socoin_atlas', 'USER': 'root', - 'PASSWORD': "", + 'PASSWORD': "password", 'HOST': '127.0.0.1', # Or an IP Address that your DB is hosted on 'PORT': '3306', 'AUTOCOMMIT': True, @@ -140,6 +152,9 @@ USE_TZ = True STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] +MEDIA_URL = '/media/' +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') + # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field @@ -148,4 +163,9 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' CLIENTI_GROUPS = 'CLIENTE' TOUR_OPERATOR_GROUPS = 'TOUR_OPERATOR' -ADMIN_GROUPS = 'ADMIN' \ No newline at end of file +ADMIN_GROUPS = 'ADMIN' + +''' +PER INTEGRARE I PAGAMENTI CON PAYPAL +https://www.youtube.com/watch?v=8rMfW4wO-vU&ab_channel=DennisIvy +''' \ No newline at end of file -- 2.43.0