30 Star 220 Fork 107

sjgops/flask-ansible

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
app.py 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
shijiange 提交于 2019-07-10 10:10 . first commit
from flask import Flask
from flask import request
from flask import render_template
from flask import redirect
from flask import session
from shijiange import shijiange
from views import views
from servers import servers
from auth import auth
from deploy import deploy
from playbook import playbook
import datetime
app = Flask(__name__)
app.config['SECRET_KEY']='mypwd'
app.permanent_session_lifetime = datetime.timedelta(minutes=1440)
app.register_blueprint(shijiange, url_prefix="/shijiange")
app.register_blueprint(views, url_prefix="/views")
app.register_blueprint(servers, url_prefix="/servers")
app.register_blueprint(auth, url_prefix="/auth")
app.register_blueprint(deploy, url_prefix="/deploy")
app.register_blueprint(playbook, url_prefix="/playbook")
@app.before_request
def before_request():
if request.path == "/static/login.html" or request.path == "/auth/login" or request.path.endswith(".js") or request.path.endswith(".css"):
pass
else:
username = session.get('username')
if not username:
return redirect('/static/login.html')
@app.route('/')
def index():
return render_template("index.html")
if __name__ == '__main__':
app.run()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/shijiange/flask-ansible.git
git@gitee.com:shijiange/flask-ansible.git
shijiange
flask-ansible
flask-ansible
master

搜索帮助