Newer
Older
from flask import Blueprint, render_template, request, redirect
from config import url_for2
from database.db import db
from models.user import Entity
home_blueprint = Blueprint('home', __name__, url_prefix='/')
@home_blueprint.route('')
def home():
return render_template('index.html')
@home_blueprint.route('/hello/<name>')
def hello(name: str):
return "Hello, " + name
# Example CRUD route
@home_blueprint.route('/entities', methods=['GET', 'POST'])
def entities():
if request.method == "GET":
try:
rows = ""
for e in db.session.query(Entity).all():
rows += str(e) + "<br>"
return rows
except:
return "App database error (have you setup a database for this app?)"
else:
username = request.form.get('username')
email = request.form.get('email')