我们提供一站式网上办事大厅招投标所需全套资料,包括师生办事大厅介绍PPT、一网通办平台产品解决方案、
师生服务大厅产品技术参数,以及对应的标书参考文件,详请联系客服。
- app.py(主程序)
- templates/(存放HTML文件)
- static/(存放CSS和JS文件)
- models.py(定义数据模型)
from flask import Flask, render_template, request, redirect, url_for app = Flask(__name__) @app.route('/') def index(): return "欢迎来到师生网上办事大厅!" if __name__ == '__main__': app.run(debug=True)
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True, nullable=False) password = db.Column(db.String(120), nullable=False)
@app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': username = request.form['username'] password = request.form['password'] user = User.query.filter_by(username=username).first() if user and user.password == password: return "登录成功" else: return "用户名或密码错误" return render_template('login.html')