diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 36c37f4..06b3c51 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" services: # Update this to the name of the service you want to work with in your docker-compose.yml file web: @@ -30,11 +30,10 @@ services: - SPEJSTORE_DB_PASSWORD=postgres - SPEJSTORE_DB_HOST=db # - SPEJSTORE_DB_PORT= - - SPEJSTORE_ALLOWED_HOSTS=localhost,127.0.0.1 + - SPEJSTORE_ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0 # - SPEJSTORE_CLIENT_ID= # - SPEJSTORE_SECRET= # - SPEJSTORE_MEDIA_ROOT= # - SPEJSTORE_REQUIRE_AUTH=true - SPEJSTORE_OAUTH_REDIRECT_IS_HTTPS=false - - SPEJSTORE_PROXY_TRUSTED_IPS=172.21.37.1 - + # - SPEJSTORE_PROXY_TRUSTED_IPS=172.21.37.1 diff --git a/.env.example b/.env.example index e348cde..0e65570 100644 --- a/.env.example +++ b/.env.example @@ -7,3 +7,14 @@ SPEJSTORE_DB_USER=postgres SPEJSTORE_DB_HOST=db SPEJSTORE_HOST="https://inventory.hackerspace.pl" SPEJSTORE_LABEL_API=https://label.waw.hackerspace.pl + + +# "filesystem" or "s3" +SPEJSTORE_FILE_STORAGE_TYPE="filesystem" + +# S3 bucket +SPEJSTORE_S3_ACCESS_KEY="SPEJSTORE_S3_ACCESS_KEY" +SPEJSTORE_S3_SECRET_KEY="SPEJSTORE_S3_SECRET_KEY" +SPEJSTORE_S3_ENDPOINT_URL="SPEJSTORE_S3_ENDPOINT_URL" +SPEJSTORE_S3_BUCKET_NAME="SPEJSTORE_S3_BUCKET_NAME" +SPEJSTORE_S3_MEDIA_LOCATION="SPEJSTORE_S3_MEDIA_LOCATION" diff --git a/docker-compose.dev-override.yml b/docker-compose.dev-override.yml deleted file mode 100644 index ffa8675..0000000 --- a/docker-compose.dev-override.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3" -services: - web: - environment: - - SPEJSTORE_ENV=dev - - SPEJSTORE_DB_NAME=postgres - - SPEJSTORE_DB_USER=postgres - - SPEJSTORE_DB_PASSWORD=postgres - - SPEJSTORE_DB_HOST=db - # - SPEJSTORE_DB_PORT= - - SPEJSTORE_ALLOWED_HOSTS=localhost,127.0.0.1 - # - SPEJSTORE_CLIENT_ID= - # - SPEJSTORE_SECRET= - # - SPEJSTORE_MEDIA_ROOT= - # - SPEJSTORE_REQUIRE_AUTH=true - - SPEJSTORE_OAUTH_REDIRECT_IS_HTTPS=false - - SPEJSTORE_PROXY_TRUSTED_IPS=172.21.37.1 diff --git a/docker-compose.prod-override.yml b/docker-compose.prod-override.yml deleted file mode 100644 index 8826d7a..0000000 --- a/docker-compose.prod-override.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: "3" - -services: - db: - volumes: - - /var/spejstore-data-new:/var/lib/postgresql/data - web: - build: . diff --git a/spejstore/settings.py b/spejstore/settings.py index e2ab05b..0499d01 100644 --- a/spejstore/settings.py +++ b/spejstore/settings.py @@ -1,15 +1,3 @@ -""" -Django settings for spejstore project. - -Generated by 'django-admin startproject' using Django 1.10.1. - -For more information on this file, see -https://docs.djangoproject.com/en/1.10/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.10/ref/settings/ -""" - import os @@ -51,7 +39,7 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.postgres", - "storages", # django-storages s3boto support + "storages", # django-storages s3boto support "social_django", "tree", "django_select2", @@ -171,6 +159,11 @@ SOCIAL_AUTH_PIPELINE = ( # Determines the storage type for Django static files and media. FILE_STORAGE_TYPE = env("FILE_STORAGE_TYPE", "filesystem") + +# Make sure we check for correct file storage type +if not (FILE_STORAGE_TYPE == "filesystem" or FILE_STORAGE_TYPE == "s3"): + raise Exception("SPEJSTORE_FILE_STORAGE_TYPE must be 'filesystem' or 's3' ") + if FILE_STORAGE_TYPE == "filesystem": STORAGES = { "default": {