mirror of
https://github.com/StefBuwalda/WebTech.git
synced 2025-10-30 11:19:58 +00:00
35 lines
806 B
Python
35 lines
806 B
Python
from flask import Flask, render_template, session
|
|
from forms import ServiceForm
|
|
|
|
# Create Flask instance
|
|
app = Flask(__name__)
|
|
app.config["SECRET_KEY"] = "mijngeheimesleutel"
|
|
|
|
|
|
# Default app route
|
|
@app.route("/")
|
|
def index():
|
|
# Return HTML content
|
|
return "<h1>This is the default page</h1>"
|
|
|
|
@app.route("/dashboard")
|
|
def dashboard():
|
|
# Return Dashboard.html
|
|
return render_template("dashboard.html")
|
|
|
|
|
|
@app.route("/forms")
|
|
def forms():
|
|
service_form = ServiceForm()
|
|
|
|
if service_form.validate_on_submit: # type: ignore
|
|
session["name"]
|
|
|
|
return render_template("forms.html", form=service_form)
|
|
|
|
|
|
# Prevent execution when imported by other script
|
|
if __name__ == "__main__":
|
|
# Start the flask server in debug mode for development purposes
|
|
app.run(port=80, debug=True)
|