Working dev env in docker

This commit is contained in:
2023-04-05 11:40:58 +02:00
parent b68f11b8cd
commit 9de772b27d
18 changed files with 142 additions and 104 deletions

View File

@@ -0,0 +1,10 @@
GUNICORN_CMD_ARGS=--bind=127.0.0.1:3000 --workers=3 --timeout=300 --error-logfile=/var/log/gunicorn-error.log
DJANGO_SUPERUSER_PASSWORD=admin
SECRET_KEY=uv88xpv8kb2r6j7rubtnhkps
DATABASE_NAME=updates_dashboard
DATABASE_USER=updates_dashboard
DATABASE_PASSWORD=miengetBatheajOf
DATABASE_HOST=mysql
DATABASE_PORT=3306
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1
DJANGO_CSRF_TRUSTED_ORIGINS=http://localhost

View File

@@ -10,11 +10,23 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
from .settings_local import *
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# for debug_toolbar
INTERNAL_IPS = ['127.0.0.1', ]
DEBUG_TOOLBAR = True
# Application definition
INSTALLED_APPS_LOCAL = [
'debug_toolbar',
# 'django_python3_ldap',
]
INSTALLED_APPS = [
'dashboard.apps.DashboardConfig',
'django.contrib.admin',
@@ -26,6 +38,10 @@ INSTALLED_APPS = [
'django_extensions',
] + INSTALLED_APPS_LOCAL
MIDDLEWARE_LOCAL = [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
MIDDLEWARE = MIDDLEWARE_LOCAL + [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
@@ -74,6 +90,23 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, './static')
# custom
RESULT_DIR = os.path.join(BASE_DIR, 'results')
RESULT_PACKAGES_DIR = os.path.join(BASE_DIR, 'results-packages')
INVENTORY_DIR = os.path.join(BASE_DIR, 'inventory')
LOGIN_URL = '/login'
LOGIN_REDIRECT_URL = 'index'
# for debug_toolbar
INTERNAL_IPS = ['127.0.0.1', ]
DEBUG_TOOLBAR = True
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/

View File

@@ -0,0 +1,19 @@
import environ
env = environ.Env()
# reading .env file
environ.Env.read_env()
ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOSTS").split(" ")
CSRF_TRUSTED_ORIGINS = env("DJANGO_CSRF_TRUSTED_ORIGINS").split(" ")
SECRET_KEY = env("SECRET_KEY")
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': env("DATABASE_NAME"),
'USER': env("DATABASE_USER"),
'PASSWORD': env("DATABASE_PASSWORD"),
'HOST': env("DATABASE_HOST"),
'PORT': int(env("DATABASE_PORT")),
}
}