Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Echocage

Echocage/app.py Secret

Last active July 10, 2018 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Echocage/f427b071cd6ef76d7f6db58c8a7eabb6 to your computer and use it in GitHub Desktop.
Save Echocage/f427b071cd6ef76d7f6db58c8a7eabb6 to your computer and use it in GitHub Desktop.
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