Вытащил часть конфига в .env файл
This commit is contained in:
10
music_storage/.env.example
Normal file
10
music_storage/.env.example
Normal file
@@ -0,0 +1,10 @@
|
||||
S3_ACCESS_KEY=""
|
||||
S3_SECRET_KEY=""
|
||||
S3_BUCKET_NAME=""
|
||||
S3_ENDPOINT_URL=""
|
||||
S3_REGION_NAME=""
|
||||
S3_SIGNATURE_VERSION=""
|
||||
|
||||
DJANGO_DEBUG=False
|
||||
SECRET_KEY=""
|
||||
ALLOWED_HOSTS=""
|
||||
@@ -9,23 +9,25 @@ https://docs.djangoproject.com/en/6.0/topics/settings/
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/6.0/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
load_dotenv(BASE_DIR / ".env")
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-=*m3r8o(%h3@7tl2-((k&t%%k)m&*b)i^4w#ixl0i$#6!gtg&+'
|
||||
SECRET_KEY = os.getenv("SECRET_KEY", "")
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = os.getenv("DJANGO_DEBUG", "False") == "True"
|
||||
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "").split(",")
|
||||
|
||||
|
||||
# Application definition
|
||||
@@ -131,12 +133,12 @@ STORAGES = {
|
||||
"default": {
|
||||
"BACKEND": "storages.backends.s3.S3Storage",
|
||||
"OPTIONS": {
|
||||
"access_key": "admin",
|
||||
"secret_key": "admintestpassword",
|
||||
"bucket_name": "dev-bucket",
|
||||
"endpoint_url": "http://192.168.88.252:9000",
|
||||
"region_name": "us-east-1",
|
||||
"signature_version": "s3v4",
|
||||
"access_key": os.getenv("S3_ACCESS_KEY", ""),
|
||||
"secret_key": os.getenv("S3_SECRET_KEY", ""),
|
||||
"bucket_name": os.getenv("S3_BUCKET_NAME", ""),
|
||||
"endpoint_url": os.getenv("S3_ENDPOINT_URL", ""),
|
||||
"region_name": os.getenv("S3_REGION_NAME", ""),
|
||||
"signature_version": os.getenv("S3_SIGNATURE_VERSION", ""),
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -9,4 +9,5 @@ dependencies = [
|
||||
"django>=6.0",
|
||||
"django-storages>=1.14.6",
|
||||
"pillow>=12.1.0",
|
||||
"python-dotenv>=1.2.1",
|
||||
]
|
||||
|
||||
11
uv.lock
generated
11
uv.lock
generated
@@ -83,6 +83,7 @@ dependencies = [
|
||||
{ name = "django" },
|
||||
{ name = "django-storages" },
|
||||
{ name = "pillow" },
|
||||
{ name = "python-dotenv" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
@@ -91,6 +92,7 @@ requires-dist = [
|
||||
{ name = "django", specifier = ">=6.0" },
|
||||
{ name = "django-storages", specifier = ">=1.14.6" },
|
||||
{ name = "pillow", specifier = ">=12.1.0" },
|
||||
{ name = "python-dotenv", specifier = ">=1.2.1" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -163,6 +165,15 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dotenv"
|
||||
version = "1.2.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f0/26/19cadc79a718c5edbec86fd4919a6b6d3f681039a2f6d66d14be94e75fb9/python_dotenv-1.2.1.tar.gz", hash = "sha256:42667e897e16ab0d66954af0e60a9caa94f0fd4ecf3aaf6d2d260eec1aa36ad6", size = 44221 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/14/1b/a298b06749107c305e1fe0f814c6c74aea7b2f1e10989cb30f544a1b3253/python_dotenv-1.2.1-py3-none-any.whl", hash = "sha256:b81ee9561e9ca4004139c6cbba3a238c32b03e4894671e181b671e8cb8425d61", size = 21230 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "s3transfer"
|
||||
version = "0.16.0"
|
||||
|
||||
Reference in New Issue
Block a user