set up docker env

This commit is contained in:
2025-05-26 15:58:45 +02:00
parent 76e542485a
commit 4b8396a3bc
3 changed files with 7 additions and 3 deletions

4
app.py
View File

@@ -20,7 +20,9 @@ def create_app():
app = Flask(__name__)
# Configure the database
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', 'postgresql://postgres:postgres@db:5432/docupulse')
# Use 'db' as host when running in Docker, 'localhost' for local development
db_host = 'db' if os.getenv('DOCKER_ENV') else 'localhost'
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', f'postgresql://postgres:1253@{db_host}:5432/docupulse')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'your-secret-key-here')
app.config['UPLOAD_FOLDER'] = os.path.join(app.root_path, 'static', 'uploads')