You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
1.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import os
class Config:
"""
配置类,用于存储应用程序的各种配置信息。
"""
# SECRET_KEY 用于 Flask 应用的会话加密和 CSRF 保护
# 首先尝试从环境变量中获取 SECRET_KEY如果环境变量中未设置则使用默认值
# 这里将默认值注释掉,使用了一个硬编码的 SECRET_KEY实际生产中不建议这样做
# SECRET_KEY = os.environ.get('SECRET_KEY') or 'your_secret_key'
SECRET_KEY = '8665e31a29ab7e12cb0f92c1dbobj1e3a6a15230fb17'
# SQLALCHEMY_DATABASE_URI 是 SQLAlchemy 用于连接数据库的 URI
# 首先尝试从环境变量中获取 DATABASE_URL如果环境变量中未设置则使用默认的 PostgreSQL 数据库连接字符串
# 这里默认连接到本地的 PostgreSQL 数据库,数据库名为 mini12306_python用户名为 postgres密码为 6
# SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or
# 'postgresql://username:password@localhost:5432/your dbname'
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or ('postgresql://postgres:6@localhost:5432'
'/mini12306_python')
# SQLALCHEMY_TRACK_MODIFICATIONS 用于控制 SQLAlchemy 是否跟踪对象的修改并发送信号
# 这里将其设置为 False以避免不必要的内存开销
SQLALCHEMY_TRACK_MODIFICATIONS = False