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)
|
||||
# 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
|
||||
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
||||
|
|
|
@ -4,4 +4,9 @@ django-autosecretkey
|
|||
|
||||
# For MySQL
|
||||
|
||||
mysqlclient
|
||||
mysqlclient
|
||||
|
||||
# For S3
|
||||
|
||||
django-storages
|
||||
boto3
|
||||
|
|
Loading…
Reference in a new issue