In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
From flask import Flask
From flask_script import Manager
From flask_migrate import Migrate,MigrateCommand
From flask_sqlalchemy import SQLAlchemy
From flask_wtf.csrf import CSRFProtect
From flask_session import Session
Import redis
App= Flask (_ _ name__)
Manager = Manager (app)
Db = SQLAlchemy (app)
Class MyConfig (object):
DEBUG = True
# configure SECRET_KEY
SECRET_KEY = "EjpNVSNQTyGi1VvWECj9TvC/+kq3oujee2kTfQUs8yCM6xX9Yjq52v54g+HVoknA"
# configuration information of the database
SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/flask_job_project"
SQLALCHEMY_TRACK_MODIFICATIONS = False
# configure constant
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
# configuration information of flask_session
SESSION_TYPE = "redis" # specifies that session is saved to redis
SESSION_USE_SIGNER = True # Let the session_id in cookie be encrypted and signed
SESSION_REDIS = redis.StrictRedis (host=REDIS_HOST, port=REDIS_PORT) # instances that use redis
PERMANENT_SESSION_LIFETIME = 86400 # session validity period (in seconds)
App.config.from_object (MyConfig)
# enable csrf protection
CSRFProtect (app)
# for database migration
Migrate (app, db)
Manager.add_command ('db',MigrateCommand)
# configure redis
Redis_store = redis.StrictRedis (host=MyConfig.REDIS_HOST, port=MyConfig.REDIS_PORT)
# configure Session
Session (app)
If _ _ name__ = ='_ _ main__':
# app.run ()
Manager.run ()
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.