diff --git a/docker-compose.yaml b/docker-compose.yaml index 7cc5359..bf2698b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -20,6 +20,10 @@ services: POSTGRES_USER: imagehost POSTGRES_DB: imagehost_db POSTGRES_HOST: postgres + S3_BUCKET: gallery-storage + S3_ACCESS_KEY_ID: totallyHacked + S3_SECRET_ACCESS_KEY: totallyHacked + S3_CUSTOM_DOMAIN: s3.wasabisys.com volumes: - .:/portal ports: diff --git a/gallery/settings.py b/gallery/settings.py index c3569ac..9d65507 100644 --- a/gallery/settings.py +++ b/gallery/settings.py @@ -41,6 +41,15 @@ EMAIL_PORT = 587 EMAIL_HOST_USER = '' EMAIL_HOST_PASSWORD = '' +# AWS or compatible s3 storage - These should be defined through the environment +AWS_STORAGE_BUCKET_NAME = os.environ.get('S3_BUCKET', '') +AWS_S3_REGION_NAME = os.environ.get('S3_REGION', '') # eg. us-east-1 +AWS_ACCESS_KEY_ID = os.environ.get('S3_ACCESS_KEY_ID', '') +AWS_SECRET_ACCESS_KEY = os.environ.get('S3_SECRET_ACCESS_KEY', '') +AWS_S3_CUSTOM_DOMAIN = os.environ.get('S3_CUSTOM_DOMAIN', None) + +STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' + # Application definition INSTALLED_APPS = [ @@ -52,6 +61,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'rest_framework', 'inline_actions', + 'storages' ] if DEBUG: INSTALLED_APPS += [ diff --git a/requirements.txt b/requirements.txt index 4a145fe..59f547e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,20 +1,29 @@ asn1crypto==0.22.0 +boto3==1.9.12 +botocore==1.12.12 cffi==1.10.0 cryptography==2.0.3 Django==1.11.4 django-debug-panel==0.8.3 django-debug-toolbar==1.8 django-inline-actions==1.1.0 +django-storages==1.7.1 djangorestframework==3.6.3 +docutils==0.14 enum34==1.1.6 +futures==3.2.0 idna==2.6 ipaddress==1.0.18 +jmespath==0.9.3 psycopg2==2.7.3 pycparser==2.18 pycrypto==2.6.1 pyOpenSSL==17.2.0 +python-dateutil==2.7.3 pytz==2017.2 +s3transfer==0.1.13 six==1.10.0 sqlparse==0.2.3 +urllib3==1.23 uWSGI==2.0.15 zipstream==1.1.4