sFNxVAG4.txt - from flask import Flask render_template request redirect url_for session from sqlalchemy.sql.functions import user from db import

sFNxVAG4.txt - from flask import Flask render_template...

This preview shows page 1 out of 1 page.

from flask import Flask, render_template, request, redirect, url_for, session from sqlalchemy.sql.functions import user from db import add_user, login_user from sqlalchemy.exc import IntegrityError app = Flask(__name__) app.secret_key = 'thedumbestkeyyoucancreate' # app=decorator @app.route('/', methods=['GET', 'POST']) def index(): if request.method == 'GET': return render_template('index.html') else: email = request.form['email'] username = request.form['username'] password = request.form['pw'] password_check = request.form['pw2'] if password != password_check: return render_template('index.html', error='password_error') try: add_user(username, email, password) except IntegrityError: return render_template('index.html', error='already_exists')
Image of page 1

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture