-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.py
More file actions
28 lines (22 loc) · 1.11 KB
/
config.py
File metadata and controls
28 lines (22 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# config.py (Final, Corrected, and Seamless Version)
import os
from datetime import timedelta
class Config:
# Standard Flask secret key
SECRET_KEY = os.environ.get('SECRET_KEY', 'a-super-secret-key-for-local-development')
TASK_RUNNER_SECRET_KEY = os.environ.get('TASK_RUNNER_SECRET_KEY', 'local-secret-runner-key')
# Session timeout configuration
PERMANENT_SESSION_LIFETIME = timedelta(days=365)
# --- THE SEAMLESS DATABASE CONFIGURATION ---
# Define a single, conventional path inside the project's root directory.
# The project lives at '/app' inside the container.
DATA_DIR = '/app/data'
DB_FILE = 'taxconsult.db'
DB_PATH = os.path.join(DATA_DIR, DB_FILE)
# Ensure the data directory exists. This command will run as the container's user.
# On Deploy.tz, this user has permission to create subdirectories inside /app.
# This resolves the "Permission denied" error.
os.makedirs(DATA_DIR, exist_ok=True)
# Always point the database URI to our conventional path.
SQLALCHEMY_DATABASE_URI = f"sqlite:///{DB_PATH}"
SQLALCHEMY_TRACK_MODIFICATIONS = False