Instantly share code, notes, and snippets.

@Echocage /app.py Secret
Last active Jul 10, 2018

Embed
What would you like to do?
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
from models import Submission #Can only be imported after db is created, trying to figure out how to move it to the top
@app.route('/')
def render_static():
return render_template('lookup.html')
from sqlalchemy import Column, Integer, DateTime, String, Text, func
import app
class User(app.db.Model)://requires app.db to be created
__tablename__ = 'users'
id = Column(Integer, primary_key=True, autoincrement=True)
email = Column(String(120), unique=True, nullable=False)
password = Column(String(120), nullable=False)
def __repr__(self):
return '<User %r>' % self.username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment