This commit is contained in:
Cloud User
2024-06-22 18:29:45 +02:00
31 changed files with 608 additions and 295 deletions

7
Reskreen/my.cnf Normal file
View File

@@ -0,0 +1,7 @@
[client]
database = django_dev
user = django_usr
password = YwVHV36ovBTXWugb
default-character-set = utf8
host =localhost
port =3306

7
Reskreen/my_dev.cnf Normal file
View File

@@ -0,0 +1,7 @@
[client]
database = django_dev
user = django_usr
password = YwVHV36ovBTXWugb
default-character-set = utf8
host =33.144.144.3
port =3306

View File

@@ -0,0 +1,11 @@
from rest_framework import permissions
class CustomPermission_DjangoModel_based(permissions.DjangoModelPermissions):
perms_map = {
'GET': ['%(app_label)s.view_%(model_name)s'],
'OPTIONS': ['%(app_label)s.view_%(model_name)s'],
'HEAD': ['%(app_label)s.view_%(model_name)s'],
'POST': ['%(app_label)s.add_%(model_name)s'],
'PUT': ['%(app_label)s.change_%(model_name)s'],
'PATCH': ['%(app_label)s.change_%(model_name)s'],
'DELETE': ['%(app_label)s.delete_%(model_name)s'],
}

View File

@@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
from pathlib import Path
import os
from .server_config import *
from Reskreen.server_config import *
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -30,6 +30,8 @@ DEBUG = cfg_dev_mode
ALLOWED_HOSTS = ["rh.ambulance-clerc.ch"]
if cfg_dev_mode:
ALLOWED_HOSTS.append("127.0.0.1")
ALLOWED_HOSTS.append("33.144.144.6")
ALLOWED_HOSTS.append("33.144.144.13")
CSRF_TRUSTED_ORIGINS = ['https://rh.ambulance-clerc.ch']
@@ -37,6 +39,7 @@ CSRF_TRUSTED_ORIGINS = ['https://rh.ambulance-clerc.ch']
LOGIN_REDIRECT_URL = '/admin'
INSTALLED_APPS = [
'jazzmin',
'django_cron',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
@@ -55,6 +58,20 @@ INSTALLED_APPS = [
'django_summernote',
]
INSTALLED_APPS += ( 'apilog.apps.ApilogConfig',)
INSTALLED_APPS += ( 'corsheaders',)
'',
#Ajout de rest_framework
INSTALLED_APPS += ('rest_framework', 'rest_framework.authtoken',)
'''REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication', #Todo prod: replace by TokenAuthentication
),
# Autres paramètres de configuration...
}'''
LANGUAGE_CODE = 'fr-CH'
if not cfg_dev_mode:
@@ -104,6 +121,7 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 2500
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
@@ -117,6 +135,22 @@ MIDDLEWARE = [
'django.middleware.locale.LocaleMiddleware',
]
CRON_CLASSES = [
"mycaldav.cron.InitTaskSync",
]
CORS_ALLOWED_ORIGINS = [
"http://33.144.144.13:4173",
"http://33.144.144.13:5173",
"http://33.144.144.13:3000",
]
MIDDLEWARE += ('apilog.middleware.APILogMiddleware',)
ROOT_URLCONF = 'Reskreen.urls'
TEMPLATES = [
@@ -149,7 +183,7 @@ if cfg_dev_mode:
'NAME': BASE_DIR / 'db.sqlite3',
}
}
'''
'''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
@@ -163,7 +197,7 @@ else:
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': 'my.cnf',
'read_default_file': os.path.join(BASE_DIR, 'Reskreen/my.cnf'),
},
}
}

View File

@@ -26,12 +26,15 @@ urlpatterns = [
path('accounts/', admin.site.urls),
path('collabs/', include('collabs.urls')),
path('vehicules/', include('vehicles.urls')),
path('comm-opmessage/', include('comm_op.urls')),
path('caldav/', include('mycaldav.urls')),
#path('collabs_hour/', include('collabs.urls')),
path('carnet_rouge/', include('carnet_rouge.urls')),
path('student_eval/', include('studenteval.urls')),
path('summernote/', include('django_summernote.urls')),
path('editor/', include('django_summernote.urls')),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
]
if settings.DEBUG: