Add S3 storage
This commit is contained in:
parent
163dab3187
commit
edb2b9c4c5
2 changed files with 24 additions and 2 deletions
|
@ -121,7 +121,24 @@ USE_TZ = True
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
STATICFILES_DIRS = [
|
||||||
|
BASE_DIR / "frontend/static/",
|
||||||
|
]
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
STATIC_ROOT = None if DEBUG else ASK.config.get("RESTOROO", "StaticRoot", fallback=BASE_DIR / "static")
|
||||||
|
|
||||||
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
LOGOUT_REDIRECT_URL = "/"
|
||||||
|
|
||||||
|
if "S3" in ASK.config:
|
||||||
|
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
|
||||||
|
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'
|
||||||
|
AWS_ACCESS_KEY_ID = ASK.config.get("S3", "AccessKey")
|
||||||
|
AWS_SECRET_ACCESS_KEY = ASK.config.get("S3", "SecretKey")
|
||||||
|
AWS_STORAGE_BUCKET_NAME = ASK.config.get("S3", "Bucket")
|
||||||
|
AWS_S3_ENDPOINT_URL = ASK.config.get("S3", "Endpoint")
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
||||||
|
|
|
@ -5,3 +5,8 @@ django-autosecretkey
|
||||||
# For MySQL
|
# For MySQL
|
||||||
|
|
||||||
mysqlclient
|
mysqlclient
|
||||||
|
|
||||||
|
# For S3
|
||||||
|
|
||||||
|
django-storages
|
||||||
|
boto3
|
||||||
|
|
Loading…
Reference in a new issue