Skip to content

Commit

Permalink
Add devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
wildjames committed Nov 24, 2024
1 parent 9e0ef55 commit 7f3e865
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:0-ubuntu-22.04",
"features": {
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/jungaretti/features/make:1": {},
"ghcr.io/devcontainers-extra/features/black:2": {},
"ghcr.io/devcontainers-extra/features/node-asdf:0": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
3000,
8000
],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo apt update; sudo apt install -y default-libmysqlclient-dev build-essential pkg-config; pip install --upgrade setuptools; make install"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
18 changes: 10 additions & 8 deletions todoqueue_backend/todoqueue_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def get_env_variable(var_name, default=None, cast_type=str):
if path.exists(dotenv_path):
print("Loading env")
load_dotenv(dotenv_path)

else:
load_dotenv()

# Fetch all the environment variables
env_debug = get_env_variable("DJANGO_DEBUG", False, bool)
Expand All @@ -56,22 +57,23 @@ def get_env_variable(var_name, default=None, cast_type=str):
"DJANGO_CACHE_LOCATION", "redis://127.0.0.1:6379/1"
)

db_name = get_env_variable("DJANGO_DB_NAME", "mydatabase")
db_user = get_env_variable("DJANGO_DB_USER", "myuser")
db_pass = get_env_variable("DJANGO_DB_PASSWORD", "mypassword")
db_host = get_env_variable("DJANGO_DB_HOST", "db")
db_port = get_env_variable("DJANGO_DB_PORT", "3306")
db_name = get_env_variable("DJANGO_DB_NAME")
db_user = get_env_variable("DJANGO_DB_USER")
db_pass = get_env_variable("DJANGO_DB_PASSWORD")
db_host = get_env_variable("DJANGO_DB_HOST")
db_port = get_env_variable("DJANGO_DB_PORT", 3306, int)

# Email credentials
EMAIL_HOST = get_env_variable("EMAIL_HOST", "localhost")
EMAIL_HOST = get_env_variable("EMAIL_HOST", "")
EMAIL_PORT = get_env_variable("EMAIL_PORT", 587, int)
EMAIL_USE_TLS = get_env_variable("EMAIL_USE_TLS", True, bool)
EMAIL_HOST_USER = get_env_variable("EMAIL_HOST_USER", "")
DEFAULT_FROM_EMAIL = get_env_variable("DEFAULT_FROM_EMAIL", "")
EMAIL_HOST_PASSWORD = get_env_variable("EMAIL_HOST_PASSWORD", "")

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = get_env_variable("DJANGO_SECRET", cast_type=None, default=urandom(32))
SECRET_KEY = get_env_variable(
"DJANGO_SECRET", cast_type=None, default=urandom(32))


# Logging verbosity
Expand Down

0 comments on commit 7f3e865

Please sign in to comment.