development branch created to preserve working deploy project
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+62
-3
@@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||
from pathlib import Path
|
||||
import os
|
||||
import environ
|
||||
from minio_backend.storage import MinioStaticStorage, MinioMediaStorage
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -21,9 +22,13 @@ environ.Env.read_env(os.path.join(BASE_DIR, '.env'))
|
||||
|
||||
SECRET_KEY = "django-insecure-g%187p84o9^rr)3#9@r3n^o2v1i%@6=+puxm7hlodg+kbsk%n#"
|
||||
|
||||
DEBUG = True
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['192.168.24.43', '127.0.0.1', 'localhost', ]
|
||||
ALLOWED_HOSTS = ['192.168.24.43', '127.0.0.1', 'localhost', 'depot.kikimor.com', ]
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = ['https://depot.kikimor.com']
|
||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
USE_X_FORWARDED_HOST = True
|
||||
|
||||
|
||||
PROJECT_APPS = [
|
||||
@@ -45,6 +50,8 @@ INSTALLED_APPS = [
|
||||
"django.contrib.staticfiles",
|
||||
"rest_framework",
|
||||
"damages_api",
|
||||
"django_minio_backend",
|
||||
"minio_backend",
|
||||
] + PROJECT_APPS
|
||||
|
||||
MIDDLEWARE = [
|
||||
@@ -145,6 +152,8 @@ STATICFILES_DIRS = [
|
||||
BASE_DIR / 'static'
|
||||
]
|
||||
|
||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||
|
||||
TEMP_FILE_FOLDER = "/tmp/damages_photos"
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||
@@ -181,8 +190,58 @@ if all([ADMIN_USER_NAME, ADMIN_USER_EMAIL]):
|
||||
MINIO_ENDPOINT = env('MINIO_ENDPOINT')
|
||||
AWS_S3_CUSTOM_DOMAIN = env('AWS_S3_CUSTOM_DOMAIN')
|
||||
MINIO_SERVER_URL = env('MINIO_SERVER_URL')
|
||||
MINIO_EXTERNAL_ENDPOINT = AWS_S3_CUSTOM_DOMAIN
|
||||
MINIO_EXTERNAL_ENDPOINT_USE_HTTPS = True
|
||||
AWS_S3_URL_PROTOCOL = env('AWS_S3_URL_PROTOCOL')
|
||||
MINIO_ACCESS_KEY = env('MINIO_ACCESS_KEY')
|
||||
MINIO_SECRET_KEY = env('MINIO_SECRET_KEY')
|
||||
MINIO_BUCKET_NAME = env('MINIO_BUCKET_NAME')
|
||||
MINIO_SECURE = False # Set to True if using HTTPS
|
||||
MINIO_SECURE = False # Set to True if using HTTPS
|
||||
MINIO_USE_HTTPS = False # Add this line
|
||||
MINIO_STATIC_BUCKET = env('MINIO_STATIC_BUCKET_NAME')
|
||||
|
||||
# django-minio-backend settings
|
||||
MINIO_STORAGE_ENDPOINT = AWS_S3_CUSTOM_DOMAIN
|
||||
MINIO_STORAGE_PORT = 443 if MINIO_SECURE else 80 # Add this line
|
||||
MINIO_STORAGE_ACCESS_KEY = env('MINIO_ACCESS_KEY')
|
||||
MINIO_STORAGE_SECRET_KEY = env('MINIO_SECRET_KEY')
|
||||
MINIO_STORAGE_USE_HTTPS = True
|
||||
MINIO_STORAGE_MEDIA_BUCKET_NAME = env('MINIO_BUCKET_NAME') # For user-uploaded media
|
||||
MINIO_STORAGE_STATIC_BUCKET_NAME = env('MINIO_STATIC_BUCKET_NAME') # For static files
|
||||
MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET = True
|
||||
MINIO_STORAGE_AUTO_CREATE_STATIC_BUCKET = True
|
||||
MINIO_STORAGE_AUTO_CREATE_POLICY = True
|
||||
MINIO_STORAGE_MEDIA_BASE_URL = f'{AWS_S3_URL_PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{env("MINIO_BUCKET_NAME")}/'
|
||||
MINIO_STORAGE_STATIC_BASE_URL = f'{AWS_S3_URL_PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{env("MINIO_STATIC_BUCKET_NAME")}/'
|
||||
|
||||
MINIO_PRIVATE_BUCKETS = [] # If you have any private buckets
|
||||
|
||||
MINIO_PUBLIC_BUCKETS = [
|
||||
env('MINIO_BUCKET_NAME'), # Just the bucket name as a string
|
||||
env('MINIO_STATIC_BUCKET_NAME') # Just the bucket name as a string
|
||||
]
|
||||
|
||||
MINIO_POLICY_ACTIONS = {
|
||||
'GET': ['get_object'],
|
||||
'PUT': ['put_object'],
|
||||
'DELETE': ['delete_object'],
|
||||
'LIST': ['list_multipart_uploads',
|
||||
'list_parts',
|
||||
'list_objects'],
|
||||
}
|
||||
|
||||
STORAGES = {
|
||||
"default": {
|
||||
"BACKEND": "minio_backend.storage.MinioMediaStorage",
|
||||
},
|
||||
"staticfiles": {
|
||||
"BACKEND": "minio_backend.storage.MinioStaticStorage",
|
||||
},
|
||||
}
|
||||
|
||||
DEFAULT_FILE_STORAGE = 'minio_backend.storage.MinioMediaStorage'
|
||||
STATICFILES_STORAGE = 'minio_backend.storage.MinioStaticStorage'
|
||||
STATIC_URL = f'{AWS_S3_URL_PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{env("MINIO_STATIC_BUCKET_NAME")}/'
|
||||
STATICFILES_LOCATION = 'static'
|
||||
MEDIA_ROOT = BASE_DIR / 'mediafiles'
|
||||
MEDIA_URL = f'{AWS_S3_URL_PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{env("MINIO_BUCKET_NAME")}/'
|
||||
|
||||
Reference in New Issue
Block a user