config.py```python
import os
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY', '')
SQLALCHEMY_ENGINE_OPTIONS = {
"pool_recycle": 600
}
class LocalConfig(Config):
DEBUG = True
DATABASE_URL = 'mysql://root:
[email protected]:3306/database_local'
SQLALCHEMY_POOL_RECYCLE = 3600
class TestConfig(Config):
DEBUG = True
DATABASE_URL = 'mysql://root:
[email protected]:3306/database_test'
SQLALCHEMY_POOL_RECYCLE = 3600
class ProductionConfig(Config):
DEBUG = False
DATABASE_URL = 'mysql://root:
[email protected]:3306/database_produce'
SQLALCHEMY_POOL_RECYCLE = 600
```
run.py```python
from flask import Flask
from config import LocalConfig, TestConfig, ProductionConfig
app = Flask(__name__)
env = 'production'
if env == 'local':
app.config.from_object(LocalConfig)
elif env == 'test':
app.config.from_object(TestConfig)
elif env == 'production':
app.config.from_object(ProductionConfig)
```