from .lib.helpers import get_static_paths, get_content_text from flask import Flask, render_template, redirect, url_for, request app = Flask(__name__) @app.route('/login', methods=['GET', 'POST']) def login(): if(request.method == 'POST'): if request.form['username'] != 'admin' or request.form['password'] != 'admin': error = 'Invalid Credentials. Please try again.' else: return redirect(url_for('home')) elif(request.method == 'GET'): return render_template('login/index.html', static_paths=get_static_paths(), content_text=get_content_text()) return 'ERROR: Invalid method.' @app.route("/", methods=['GET']) def hello(): return render_template('homepage.html', static_paths=get_static_paths(), content_text=get_content_text()) def main(): app.run(host='0.0.0.0', debug=True)