diff --git a/docker-compose.yml b/docker-compose.yml index bfc70fe..2837655 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,10 +8,11 @@ services: volumes: - .:/app environment: - - FLASK_ENV=production + - FLASK_ENV=development + - DISABLE_ANALYTICS=true restart: unless-stopped - # Use Gunicorn with gevent workers for better async performance - command: ["gunicorn", "--bind", "0.0.0.0:8000", "--worker-class", "gevent", "--workers", "4", "--worker-connections", "1000", "--timeout", "60", "engine:app"] + # Use single worker for local development + command: ["gunicorn", "--bind", "0.0.0.0:8000", "--worker-class", "gevent", "--workers", "1", "--worker-connections", "1000", "--timeout", "60", "--reload", "engine:app"] # Alternative dev configuration - uncomment to use Flask dev server # web-dev: diff --git a/engine.py b/engine.py index be7b159..e0e6c12 100644 --- a/engine.py +++ b/engine.py @@ -12,6 +12,9 @@ import html app = Flask(__name__, template_folder='templates') +# Configuration +app.config['DISABLE_ANALYTICS'] = os.environ.get('DISABLE_ANALYTICS', 'false').lower() == 'true' + # Add custom Jinja2 filters @app.template_filter('strftime') def strftime_filter(date, fmt='%Y-%m-%d'): diff --git a/templates/base.html b/templates/base.html index 711957d..144580b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -805,6 +805,7 @@ {% block extra_head %}{% endblock %} + {% if not (config.get('DISABLE_ANALYTICS') or request.environ.get('DISABLE_ANALYTICS')) %} + {% endif %}