Add settings for storage in s3 bucket

This commit is contained in:
c0de 2018-09-26 20:53:12 -05:00
parent e4163e8af1
commit b00053acdf
3 changed files with 23 additions and 0 deletions

View File

@ -20,6 +20,10 @@ services:
POSTGRES_USER: imagehost POSTGRES_USER: imagehost
POSTGRES_DB: imagehost_db POSTGRES_DB: imagehost_db
POSTGRES_HOST: postgres POSTGRES_HOST: postgres
S3_BUCKET: gallery-storage
S3_ACCESS_KEY_ID: totallyHacked
S3_SECRET_ACCESS_KEY: totallyHacked
S3_CUSTOM_DOMAIN: s3.wasabisys.com
volumes: volumes:
- .:/portal - .:/portal
ports: ports:

View File

@ -41,6 +41,15 @@ EMAIL_PORT = 587
EMAIL_HOST_USER = '' EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = '' 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 # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
@ -52,6 +61,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'rest_framework', 'rest_framework',
'inline_actions', 'inline_actions',
'storages'
] ]
if DEBUG: if DEBUG:
INSTALLED_APPS += [ INSTALLED_APPS += [

View File

@ -1,20 +1,29 @@
asn1crypto==0.22.0 asn1crypto==0.22.0
boto3==1.9.12
botocore==1.12.12
cffi==1.10.0 cffi==1.10.0
cryptography==2.0.3 cryptography==2.0.3
Django==1.11.4 Django==1.11.4
django-debug-panel==0.8.3 django-debug-panel==0.8.3
django-debug-toolbar==1.8 django-debug-toolbar==1.8
django-inline-actions==1.1.0 django-inline-actions==1.1.0
django-storages==1.7.1
djangorestframework==3.6.3 djangorestframework==3.6.3
docutils==0.14
enum34==1.1.6 enum34==1.1.6
futures==3.2.0
idna==2.6 idna==2.6
ipaddress==1.0.18 ipaddress==1.0.18
jmespath==0.9.3
psycopg2==2.7.3 psycopg2==2.7.3
pycparser==2.18 pycparser==2.18
pycrypto==2.6.1 pycrypto==2.6.1
pyOpenSSL==17.2.0 pyOpenSSL==17.2.0
python-dateutil==2.7.3
pytz==2017.2 pytz==2017.2
s3transfer==0.1.13
six==1.10.0 six==1.10.0
sqlparse==0.2.3 sqlparse==0.2.3
urllib3==1.23
uWSGI==2.0.15 uWSGI==2.0.15
zipstream==1.1.4 zipstream==1.1.4