Compare commits
2 commits
ea09e6a49e
...
358a27b737
Author | SHA1 | Date | |
---|---|---|---|
358a27b737 | |||
c8332109bb |
2 changed files with 27 additions and 26 deletions
|
@ -14,10 +14,14 @@ CONFIG = ASK.config
|
||||||
|
|
||||||
SECRET_KEY = ASK.secret_key
|
SECRET_KEY = ASK.secret_key
|
||||||
DEBUG = CONFIG.getboolean("PIX360", "Debug", fallback=False)
|
DEBUG = CONFIG.getboolean("PIX360", "Debug", fallback=False)
|
||||||
ALLOWED_HOSTS = [h.strip() for h in CONFIG.get("PIX360", "Hosts", fallback="localhost").split(",")]
|
ALLOWED_HOSTS = [
|
||||||
|
h.strip() for h in CONFIG.get("PIX360", "Hosts", fallback="localhost").split(",")
|
||||||
|
]
|
||||||
CSRF_TRUSTED_ORIGINS = [f"https://{h}" for h in ALLOWED_HOSTS]
|
CSRF_TRUSTED_ORIGINS = [f"https://{h}" for h in ALLOWED_HOSTS]
|
||||||
|
|
||||||
SECURE_PROXY_SSL_HEADER_NAME = CONFIG.get("KEYLOG", "SSLHeaderName", fallback="HTTP_X_FORWARDED_PROTO")
|
SECURE_PROXY_SSL_HEADER_NAME = CONFIG.get(
|
||||||
|
"KEYLOG", "SSLHeaderName", fallback="HTTP_X_FORWARDED_PROTO"
|
||||||
|
)
|
||||||
SECURE_PROXY_SSL_HEADER_VALUE = CONFIG.get("KEYLOG", "SSLHeaderValue", fallback="https")
|
SECURE_PROXY_SSL_HEADER_VALUE = CONFIG.get("KEYLOG", "SSLHeaderValue", fallback="https")
|
||||||
SECURE_PROXY_SSL_HEADER = (SECURE_PROXY_SSL_HEADER_NAME, SECURE_PROXY_SSL_HEADER_VALUE)
|
SECURE_PROXY_SSL_HEADER = (SECURE_PROXY_SSL_HEADER_NAME, SECURE_PROXY_SSL_HEADER_VALUE)
|
||||||
|
|
||||||
|
@ -31,7 +35,6 @@ INSTALLED_APPS = [
|
||||||
"django.contrib.sessions",
|
"django.contrib.sessions",
|
||||||
"django.contrib.messages",
|
"django.contrib.messages",
|
||||||
"django.contrib.staticfiles",
|
"django.contrib.staticfiles",
|
||||||
|
|
||||||
"pix360core",
|
"pix360core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -71,21 +74,21 @@ WSGI_APPLICATION = "pix360.wsgi.application"
|
||||||
|
|
||||||
if (dbtype := "MySQL") in CONFIG or (dbtype := "MariaDB") in CONFIG:
|
if (dbtype := "MySQL") in CONFIG or (dbtype := "MariaDB") in CONFIG:
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
"default": {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
"ENGINE": "django.db.backends.mysql",
|
||||||
'NAME': CONFIG.get(dbtype, "Database"),
|
"NAME": CONFIG.get(dbtype, "Database"),
|
||||||
'USER': CONFIG.get(dbtype, "Username"),
|
"USER": CONFIG.get(dbtype, "Username"),
|
||||||
'PASSWORD': CONFIG.get(dbtype, "Password"),
|
"PASSWORD": CONFIG.get(dbtype, "Password"),
|
||||||
'HOST': CONFIG.get(dbtype, "Host", fallback="localhost"),
|
"HOST": CONFIG.get(dbtype, "Host", fallback="localhost"),
|
||||||
'PORT': CONFIG.getint(dbtype, "Port", fallback=3306)
|
"PORT": CONFIG.getint(dbtype, "Port", fallback=3306),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
"default": {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
"NAME": BASE_DIR / "db.sqlite3",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +115,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
|
||||||
if "OIDC" in CONFIG:
|
if "OIDC" in CONFIG:
|
||||||
AUTHENTICATION_BACKENDS = [
|
AUTHENTICATION_BACKENDS = [
|
||||||
'pix360core.backends.OIDCBackend',
|
"pix360core.backends.OIDCBackend",
|
||||||
]
|
]
|
||||||
|
|
||||||
LOGIN_URL = reverse_lazy("oidc_authentication_init")
|
LOGIN_URL = reverse_lazy("oidc_authentication_init")
|
||||||
|
@ -133,16 +136,16 @@ if "OIDC" in CONFIG:
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -170,15 +173,13 @@ USE_TZ = True
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = "/static/"
|
||||||
|
|
||||||
STATIC_ROOT = None if DEBUG else CONFIG.get(
|
STATIC_ROOT = None if DEBUG else CONFIG.get("PIX360", "StaticRoot", fallback=None)
|
||||||
"PIX360", "StaticRoot", fallback=None)
|
|
||||||
|
|
||||||
CORE_STATIC_DIR = Path(pix360core.__file__).parent / "static"
|
CORE_STATIC_DIR = Path(pix360core.__file__).parent / "static"
|
||||||
|
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = []
|
||||||
]
|
|
||||||
|
|
||||||
# Settings for uploaded files
|
# Settings for uploaded files
|
||||||
|
|
||||||
|
@ -186,8 +187,8 @@ MEDIA_URL = "/media/"
|
||||||
MEDIA_ROOT = CONFIG.get("PIX360", "MediaRoot", fallback=BASE_DIR / "media")
|
MEDIA_ROOT = CONFIG.get("PIX360", "MediaRoot", fallback=BASE_DIR / "media")
|
||||||
|
|
||||||
if "S3" in CONFIG:
|
if "S3" in CONFIG:
|
||||||
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
|
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
||||||
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'
|
STATICFILES_STORAGE = "storages.backends.s3boto3.S3StaticStorage"
|
||||||
AWS_ACCESS_KEY_ID = CONFIG.get("S3", "AccessKey")
|
AWS_ACCESS_KEY_ID = CONFIG.get("S3", "AccessKey")
|
||||||
AWS_SECRET_ACCESS_KEY = CONFIG.get("S3", "SecretKey")
|
AWS_SECRET_ACCESS_KEY = CONFIG.get("S3", "SecretKey")
|
||||||
AWS_STORAGE_BUCKET_NAME = CONFIG.get("S3", "Bucket")
|
AWS_STORAGE_BUCKET_NAME = CONFIG.get("S3", "Bucket")
|
||||||
|
|
|
@ -7,4 +7,4 @@ argon2-cffi
|
||||||
|
|
||||||
django-autosecretkey
|
django-autosecretkey
|
||||||
|
|
||||||
git+https://kumig.it/kumisystems/pix360core.git
|
git+https://git.private.coffee/kumisystems/pix360core.git
|
||||||
|
|
Loading…
Reference in a new issue