A Unix-style Python web framework: filesystem routing, flat files, messages and cron, with CGI's simplicity at modern speed.

0 downloads

dbbasic-web/dbbasic_web/settings.py
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-web.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-web.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-web.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst Replace multipart parser with stdlib-only implementation eb957a2 9 months, 2 weeks ago History
settings.py · 815 bytes · 27 lines
1"""Application settings and configuration"""
2import os
3from pathlib import Path
4
5# Allow override from environment or use current working directory if api/ exists
6_cwd = Path.cwd()
7if (_cwd / "api").exists() or (_cwd / "templates").exists():
8 # Running from a project directory
9 BASE_DIR = _cwd
10 PROJECT_ROOT = _cwd.parent
11else:
12 # Running from installed package (fallback)
13 BASE_DIR = Path(__file__).resolve().parent
14 PROJECT_ROOT = BASE_DIR.parent
15
16DEBUG = os.getenv("DEBUG", "1") == "1"
17
18# Static / templates
19TEMPLATES_DIR = BASE_DIR / "templates"
20PUBLIC_DIR = BASE_DIR / "public"
21
22# File storage root (flat files, TSV databases, job queues, event streams)
23DATA_DIR = PROJECT_ROOT / "_data"
24DATA_DIR.mkdir(exist_ok=True)
25
26# Security
27SECRET_KEY = os.getenv("SECRET_KEY", "dev-secret-change-me")