Loading version code env var into web server app
This commit is contained in:
parent
ea855dc311
commit
4eb0203b2d
3 changed files with 5 additions and 0 deletions
2
Makefile
2
Makefile
|
@ -2,10 +2,12 @@ APP_HOST ?= 0.0.0.0
|
||||||
APP_PORT ?= 8000
|
APP_PORT ?= 8000
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
|
python3 -m dotenv -f version_code run \
|
||||||
python3 -m dotenv -f .env_debug run \
|
python3 -m dotenv -f .env_debug run \
|
||||||
make cmd-dev
|
make cmd-dev
|
||||||
|
|
||||||
prod:
|
prod:
|
||||||
|
python3 -m dotenv -f version_code run \
|
||||||
python3 -m gunicorn \
|
python3 -m gunicorn \
|
||||||
-w 4 -k uvicorn.workers.UvicornWorker \
|
-w 4 -k uvicorn.workers.UvicornWorker \
|
||||||
-b $${APP_HOST}:$${APP_PORT} main:app
|
-b $${APP_HOST}:$${APP_PORT} main:app
|
||||||
|
|
|
@ -61,6 +61,8 @@ Make commands:
|
||||||
loaded only in docker-compose by default
|
loaded only in docker-compose by default
|
||||||
- `.env_db` is a config for MySQL/MariaDB server,
|
- `.env_db` is a config for MySQL/MariaDB server,
|
||||||
also loaded only in docker-compose for the mariadb container
|
also loaded only in docker-compose for the mariadb container
|
||||||
|
- `version` contains only one variable, your application version code;
|
||||||
|
change it whatever you want or leave `1.0.0`
|
||||||
#### The main config loaded by `app/common.py`:
|
#### The main config loaded by `app/common.py`:
|
||||||
- `templates_dir`, `static_dir` contain the paths
|
- `templates_dir`, `static_dir` contain the paths
|
||||||
to templates and static files directories correspondingly
|
to templates and static files directories correspondingly
|
||||||
|
|
|
@ -14,6 +14,7 @@ static_dir = str(file_dir.parent / 'static')
|
||||||
|
|
||||||
# Main configuration
|
# Main configuration
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
|
version: str = '1.0.0'
|
||||||
debug: bool = False
|
debug: bool = False
|
||||||
session_key: str = 'secret'
|
session_key: str = 'secret'
|
||||||
csrf_key: str = 'secret'
|
csrf_key: str = 'secret'
|
||||||
|
|
Loading…
Reference in a new issue