From d7ccf5789a757af1f608c06645774e0c46944ce8 Mon Sep 17 00:00:00 2001 From: Guillim Date: Tue, 18 Jun 2019 10:18:48 +0200 Subject: [PATCH] Env variables: We want to allow the admin to choose wether the users can signin in by themselves, or if only the admin can do it. We will later implement it in the python code Here we have to modify - docker-compose.yml : add the env ALLOW_SIGNUP Note: I am not sure if it's True or "True" Note: we could have put it inside the Dockerfile instead of docker-compose, it doesn't matter. - settings.py : Here we make the env variable available to the python app - app.json : that's for the heroku deployment. we simply describe to heroku that we have an env variable --- app.json | 5 +++++ app/app/settings.py | 3 +++ docker-compose.yml | 1 + 3 files changed, 9 insertions(+) diff --git a/app.json b/app.json index f47e8f2f..2278bf5a 100644 --- a/app.json +++ b/app.json @@ -29,6 +29,11 @@ "description": "Debug mode or not.", "required": false, "value": "False" + }, + "ALLOW_SIGNUP": { + "description": "Allow users to signup themselves or not", + "required": false, + "value": "True" } }, "scripts": { diff --git a/app/app/settings.py b/app/app/settings.py index 58f55bc0..df0e2d04 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -35,6 +35,9 @@ SECRET_KEY = env('SECRET_KEY', # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool('DEBUG', True) +# True if you want to allow users to be able to create an account +ALLOW_SIGNUP = env.bool('ALLOW_SIGNUP', True) + # ALLOWED_HOSTS = [] diff --git a/docker-compose.yml b/docker-compose.yml index f8787a79..5ae6bc69 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,7 @@ services: ADMIN_PASSWORD: "password" ADMIN_EMAIL: "admin@example.com" DATABASE_URL: "postgres://doccano:doccano@postgres:5432/doccano?sslmode=disable" + ALLOW_SIGNUP: "True" ports: - 8000:8000