services:
  - type: web
    name: esitmecihazlari
    runtime: python
    plan: free
    buildCommand: pip install -r requirements.txt && python manage.py migrate && python manage.py collectstatic --noinput && python manage.py seed_demo
    startCommand: gunicorn config.wsgi:application --bind 0.0.0.0:$PORT --workers 2 --timeout 120
    healthCheckPath: /health/
    envVars:
      - key: PYTHON_VERSION
        value: 3.12.13
      - key: DJANGO_DEBUG
        value: "False"
      - key: DJANGO_SECRET_KEY
        generateValue: true
      - key: DJANGO_ALLOWED_HOSTS
        value: esitmecihazlari.az,www.esitmecihazlari.az,.onrender.com
      - key: DJANGO_CSRF_TRUSTED_ORIGINS
        value: https://esitmecihazlari.az,https://www.esitmecihazlari.az,https://*.onrender.com
      - key: DJANGO_SECURE_SSL_REDIRECT
        value: "True"
      - key: DATABASE_URL
        fromDatabase:
          name: esitmecihazlari-db
          property: connectionString

databases:
  - name: esitmecihazlari-db
    plan: free
