flask configuration config file

class Config (object):
Information # connect to the database, # url format: protocol database: // username: password @ip address: port number (default can not write) / database name
SQLALCHEMY_DATABASE_URI = "mysql + pymysql: //root:[email protected]:3306/flaskfive "
modify # dynamic tracking database.
SQLALCHEMY_TRACK_MODIFICATIONS = False
# prints native sql statement, easy to observe the test
SQLALCHEMY_ECHO = True # prints native sql statement, easy to observe the test

# In the flask project, Session, Cookies and some third-party extensions will be used SECRET_KEY value, this is a more important configuration values.
# Set keys
SECRET_KEY = "123456"

 

Configuration operation:
① app.py import configuration file in the main,
from config Import Config
② loading configuration
app.config.from_object (Config)

Guess you like

Origin www.cnblogs.com/lnd-blog/p/11584452.html