fix: use blueprint
This commit is contained in:
parent
00723801cc
commit
4ad4deea87
7
home.py
7
home.py
@ -1,6 +1,7 @@
|
|||||||
import main
|
|
||||||
import flask
|
import flask
|
||||||
|
|
||||||
@main.app.route("/", methods = ['GET'])
|
home = flask.Blueprint("home", __name__, template_folder="templates")
|
||||||
def home():
|
|
||||||
|
@home.route("/")
|
||||||
|
def show():
|
||||||
return (flask.render_template("home/index.html"))
|
return (flask.render_template("home/index.html"))
|
||||||
|
10
login.py
10
login.py
@ -1,10 +1,12 @@
|
|||||||
import main
|
|
||||||
import flask
|
import flask
|
||||||
|
|
||||||
@main.app.route("/login", methods = ['POST', 'GET'])
|
login = flask.Blueprint("login", __name__, template_folder="templates")
|
||||||
def login():
|
|
||||||
if (flask.request.methods == ['GET']):
|
@login.route("/login", methods=['POST', 'GET'])
|
||||||
|
def show():
|
||||||
|
if (flask.request.method == ['GET']):
|
||||||
return (flask.render_template("login/login.html"))
|
return (flask.render_template("login/login.html"))
|
||||||
else:
|
else:
|
||||||
|
return ("bozo")
|
||||||
email = flask.request.form['email']
|
email = flask.request.form['email']
|
||||||
password = flask.request.form['password']
|
password = flask.request.form['password']
|
||||||
|
3
main.py
3
main.py
@ -1,8 +1,11 @@
|
|||||||
import flask
|
import flask
|
||||||
import database
|
import database
|
||||||
|
import home, login
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
|
|
||||||
if (__name__ == "__main__"):
|
if (__name__ == "__main__"):
|
||||||
|
app.register_blueprint(home.home)
|
||||||
|
app.register_blueprint(login.login)
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user