Add support for Development Containers
PATCH 1/3 Add support for Development Containers
This lowers the barrier of entry for new contributors by setting up a completely functional layerindex system from a clean repository.
More on dev containers: https://containers.dev
--- .devcontainer/.env | 6 +++ .devcontainer/devcontainer.json | 63 ++++++++++++++++++++++++++++++++ .devcontainer/docker-compose.yml | 56 ++++++++++++++++++++++++++++ README.vscode | 50 +++++++++++++++++++++++++ 4 files changed, 175 insertions(+) create mode 100644 .devcontainer/.env create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml create mode 100644 README.vscode
.devcontainer/.env new file +6 -0
@@ -0,0 +1,6 @@ +DJANGO_SETTINGS_MODULE = 'docker.settings' +DEBUG = 1 +SECRET_KEY = 'replace-me' +HOSTNAME = 'localhost' +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' +BASE_DIR = '/opt/layerindex'
.devcontainer/devcontainer.json new file +63 -0
64 lines not on this page · raw message
.devcontainer/docker-compose.yml new file +56 -0
56 lines not on this page · raw message
README.vscode new file +50 -0
51 lines not on this page · raw message
PATCH 2/3 Configure ruff code formater to preserve quote style
Current code uses a mix of single and double quotes, and that causes a lot of code changes every time a file is formatted with ruff. This ruff configuration gets us all the benfits of automated code formating withough the downside of having to unify the whole code base in terms of quote styling.
--- ruff.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 ruff.toml
ruff.toml new file +2 -0
@@ -0,0 +1,2 @@ +[format] +quote-style = "preserve"
PATCH 3/3 Extend support for environmental variables in docker/settings.py
In reply to Piotr BulińskiThis change will allow devcontainer (or any other way of deploying the system) to provide values for BASE_DIR and EMAIL_BACKEND through environmental varialbles.
--- docker/settings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
docker/settings.py +4 -1
@@ -50,7 +50,7 @@ USE_I18N = True USE_L10N = True # Avoid specific paths -BASE_DIR = os.path.dirname(__file__) +BASE_DIR = os.getenv('BASE_DIR', os.path.dirname(__file__)) # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/"
@@ -231,6 +231,9 @@ MESSAGE_TAGS = { # Registration settings ACCOUNT_ACTIVATION_DAYS = 2 +EMAIL_BACKEND = os.getenv( + "EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend" +) EMAIL_HOST = os.getenv('EMAIL_HOST', 'layers.test') EMAIL_PORT = os.getenv('EMAIL_PORT', '25') EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS', False)