Flask · Schema

Flask Application Configuration

JSON Schema for Flask application configuration values, covering core settings, session, security, template, and common extension configuration.

FrameworksLightweightMicroframeworkPalletsPythonWeb FrameworkWSGI

Properties

Name Type Description
DEBUG boolean Enable debug mode.
TESTING boolean Enable testing mode.
SECRET_KEY string Secret key for session signing and CSRF protection.
ENV string Application environment (deprecated in Flask 2.3+).
SERVER_NAME string Server name for URL generation (host:port).
APPLICATION_ROOT string Application root path.
PREFERRED_URL_SCHEME string URL scheme for URL generation.
MAX_CONTENT_LENGTH integer Maximum request content length in bytes.
MAX_COOKIE_SIZE integer Maximum cookie size warning threshold.
SESSION_COOKIE_NAME string Name of the session cookie.
SESSION_COOKIE_DOMAIN string Domain for the session cookie.
SESSION_COOKIE_PATH string Path for the session cookie.
SESSION_COOKIE_HTTPONLY boolean Set HttpOnly flag on session cookie.
SESSION_COOKIE_SECURE boolean Set Secure flag on session cookie.
SESSION_COOKIE_SAMESITE string SameSite attribute for session cookie.
PERMANENT_SESSION_LIFETIME integer Permanent session lifetime in seconds.
SESSION_REFRESH_EACH_REQUEST boolean Refresh cookie on each request.
JSON_SORT_KEYS boolean Sort keys in JSON responses.
JSONIFY_MIMETYPE string MIME type for jsonify responses.
TEMPLATES_AUTO_RELOAD boolean Auto-reload templates on change.
EXPLAIN_TEMPLATE_LOADING boolean Log template loading for debugging.
TRAP_HTTP_EXCEPTIONS boolean Trap HTTP exceptions for debugging.
TRAP_BAD_REQUEST_ERRORS boolean Trap bad request errors.
PROPAGATE_EXCEPTIONS boolean Propagate exceptions instead of handling.
SQLALCHEMY_DATABASE_URI string SQLAlchemy database connection URI (Flask-SQLAlchemy extension).
SQLALCHEMY_TRACK_MODIFICATIONS boolean Track SQLAlchemy model modifications.
SQLALCHEMY_ECHO boolean Echo SQL statements.
SQLALCHEMY_POOL_SIZE integer Connection pool size.
SQLALCHEMY_POOL_TIMEOUT integer Pool checkout timeout in seconds.
SQLALCHEMY_MAX_OVERFLOW integer Max connections beyond pool size.
MAIL_SERVER string Mail server hostname (Flask-Mail extension).
MAIL_PORT integer Mail server port.
MAIL_USE_TLS boolean Use TLS for mail.
MAIL_USE_SSL boolean Use SSL for mail.
MAIL_USERNAME string Mail server username.
MAIL_PASSWORD string Mail server password.
CACHE_TYPE string Cache backend type (Flask-Caching extension).
CACHE_DEFAULT_TIMEOUT integer Default cache timeout in seconds.
CACHE_REDIS_URL string Redis URL for cache backend.
CORS_ORIGINS array Allowed origins for CORS (Flask-CORS extension).
CORS_METHODS array Allowed HTTP methods for CORS.
CORS_SUPPORTS_CREDENTIALS boolean Allow credentials in CORS requests.
View JSON Schema on GitHub

JSON Schema

flask-config.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/api-evangelist/flask/json-schema/flask-config.json",
  "title": "Flask Application Configuration",
  "description": "JSON Schema for Flask application configuration values, covering core settings, session, security, template, and common extension configuration.",
  "type": "object",
  "properties": {
    "DEBUG": {
      "type": "boolean",
      "description": "Enable debug mode.",
      "default": false
    },
    "TESTING": {
      "type": "boolean",
      "description": "Enable testing mode.",
      "default": false
    },
    "SECRET_KEY": {
      "type": "string",
      "description": "Secret key for session signing and CSRF protection."
    },
    "ENV": {
      "type": "string",
      "description": "Application environment (deprecated in Flask 2.3+).",
      "enum": ["production", "development", "testing"],
      "default": "production"
    },
    "SERVER_NAME": {
      "type": "string",
      "description": "Server name for URL generation (host:port)."
    },
    "APPLICATION_ROOT": {
      "type": "string",
      "description": "Application root path.",
      "default": "/"
    },
    "PREFERRED_URL_SCHEME": {
      "type": "string",
      "description": "URL scheme for URL generation.",
      "enum": ["http", "https"],
      "default": "http"
    },
    "MAX_CONTENT_LENGTH": {
      "type": "integer",
      "description": "Maximum request content length in bytes."
    },
    "MAX_COOKIE_SIZE": {
      "type": "integer",
      "description": "Maximum cookie size warning threshold.",
      "default": 4093
    },
    "SESSION_COOKIE_NAME": {
      "type": "string",
      "description": "Name of the session cookie.",
      "default": "session"
    },
    "SESSION_COOKIE_DOMAIN": {
      "type": "string",
      "description": "Domain for the session cookie."
    },
    "SESSION_COOKIE_PATH": {
      "type": "string",
      "description": "Path for the session cookie.",
      "default": "/"
    },
    "SESSION_COOKIE_HTTPONLY": {
      "type": "boolean",
      "description": "Set HttpOnly flag on session cookie.",
      "default": true
    },
    "SESSION_COOKIE_SECURE": {
      "type": "boolean",
      "description": "Set Secure flag on session cookie.",
      "default": false
    },
    "SESSION_COOKIE_SAMESITE": {
      "type": "string",
      "description": "SameSite attribute for session cookie.",
      "enum": ["Strict", "Lax", "None"],
      "default": "Lax"
    },
    "PERMANENT_SESSION_LIFETIME": {
      "type": "integer",
      "description": "Permanent session lifetime in seconds.",
      "default": 2678400
    },
    "SESSION_REFRESH_EACH_REQUEST": {
      "type": "boolean",
      "description": "Refresh cookie on each request.",
      "default": true
    },
    "JSON_SORT_KEYS": {
      "type": "boolean",
      "description": "Sort keys in JSON responses.",
      "default": true
    },
    "JSONIFY_MIMETYPE": {
      "type": "string",
      "description": "MIME type for jsonify responses.",
      "default": "application/json"
    },
    "TEMPLATES_AUTO_RELOAD": {
      "type": "boolean",
      "description": "Auto-reload templates on change."
    },
    "EXPLAIN_TEMPLATE_LOADING": {
      "type": "boolean",
      "description": "Log template loading for debugging.",
      "default": false
    },
    "TRAP_HTTP_EXCEPTIONS": {
      "type": "boolean",
      "description": "Trap HTTP exceptions for debugging.",
      "default": false
    },
    "TRAP_BAD_REQUEST_ERRORS": {
      "type": "boolean",
      "description": "Trap bad request errors.",
      "default": false
    },
    "PROPAGATE_EXCEPTIONS": {
      "type": "boolean",
      "description": "Propagate exceptions instead of handling."
    },
    "SQLALCHEMY_DATABASE_URI": {
      "type": "string",
      "description": "SQLAlchemy database connection URI (Flask-SQLAlchemy extension)."
    },
    "SQLALCHEMY_TRACK_MODIFICATIONS": {
      "type": "boolean",
      "description": "Track SQLAlchemy model modifications.",
      "default": false
    },
    "SQLALCHEMY_ECHO": {
      "type": "boolean",
      "description": "Echo SQL statements.",
      "default": false
    },
    "SQLALCHEMY_POOL_SIZE": {
      "type": "integer",
      "description": "Connection pool size.",
      "default": 5
    },
    "SQLALCHEMY_POOL_TIMEOUT": {
      "type": "integer",
      "description": "Pool checkout timeout in seconds.",
      "default": 10
    },
    "SQLALCHEMY_MAX_OVERFLOW": {
      "type": "integer",
      "description": "Max connections beyond pool size.",
      "default": 10
    },
    "MAIL_SERVER": {
      "type": "string",
      "description": "Mail server hostname (Flask-Mail extension).",
      "default": "localhost"
    },
    "MAIL_PORT": {
      "type": "integer",
      "description": "Mail server port.",
      "default": 25
    },
    "MAIL_USE_TLS": {
      "type": "boolean",
      "description": "Use TLS for mail.",
      "default": false
    },
    "MAIL_USE_SSL": {
      "type": "boolean",
      "description": "Use SSL for mail.",
      "default": false
    },
    "MAIL_USERNAME": {
      "type": "string",
      "description": "Mail server username."
    },
    "MAIL_PASSWORD": {
      "type": "string",
      "description": "Mail server password."
    },
    "CACHE_TYPE": {
      "type": "string",
      "description": "Cache backend type (Flask-Caching extension).",
      "enum": ["NullCache", "SimpleCache", "FileSystemCache", "RedisCache", "MemcachedCache"],
      "default": "NullCache"
    },
    "CACHE_DEFAULT_TIMEOUT": {
      "type": "integer",
      "description": "Default cache timeout in seconds.",
      "default": 300
    },
    "CACHE_REDIS_URL": {
      "type": "string",
      "description": "Redis URL for cache backend."
    },
    "CORS_ORIGINS": {
      "type": "array",
      "description": "Allowed origins for CORS (Flask-CORS extension).",
      "items": {
        "type": "string"
      }
    },
    "CORS_METHODS": {
      "type": "array",
      "description": "Allowed HTTP methods for CORS.",
      "items": {
        "type": "string"
      }
    },
    "CORS_SUPPORTS_CREDENTIALS": {
      "type": "boolean",
      "description": "Allow credentials in CORS requests.",
      "default": false
    }
  },
  "additionalProperties": true
}