Exemplo n.º 1
0
from flask import Flask, render_template, request, session, Response, redirect
from database import connector
from model import entities
import json

db = connector.Manager()
engine = db.createEngine()

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/static/<content>')
def static_content(content):
    return render_template(content)


@app.route('/users', methods=['POST'])
def create_user():
    c = json.loads(request.form['values'])
    user = entities.User(username=c['username'],
                         name=c['name'],
                         fullname=c['fullname'],
                         password=c['password'])
    session = db.getSession(engine)
    session.add(user)
    session.commit()
from flask import Flask, render_template, request, session, Response, redirect

from typing import List

import sympy
import json
import time

if __package__ is None or __package__ == '':
    from database import connector
    from model import entities
else:
    from .database import connector
    from .model import entities

db: connector.Manager = connector.Manager()
engine = db.createEngine()

app = Flask(__name__)


@app.route('/static/<content>')
def static_content(content):
    return render_template(content)


# CROUT users


# 1. Create
@app.route('/users', methods=['POST'])