def init_database(): db.create_all() user1 = User(name='Eric Anderson', password='******') user2 = User(name='Rochelle Anderson', password='******') db.session.add(user1) db.session.add(user2) db.session.commit()
def storeQuiz(): """creating a route to stores quiz question and answers on the database....""" a1 = request.form['a1'] a2 = request.form['a2'] new_entry = Entry(a1, a2) db.create_all() db.session.add(new_entry) db.session.commit() temp = {} temp['status'] = (type(new_entry) == Entry) return jsonify(temp)
def setUp(self): app.config['TESTING'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' db.create_all() yield db db.drop_all()
def check(): """this reads all quiz questions and answers stored in db and shows it to user""" db.create_all() allEntries = Entry.query.all() return render_template('answers.html', result=allEntries)
from flask import Flask, render_template, request, url_for, session, redirect from flask import send_file #from . import create_app from library import bookshelf from library import Book from user import User, app, db import password as p from library import Block from library import Transaction from library import Regulator import os # app= Flask(__name__) # app=create_app() db.create_all() app.secret_key = os.urandom(16) # app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False shelf = bookshelf.Bookshelf() @app.route('/') def index(): if 'username' in session: if (bool(shelf.library) == False): #shelf=Bookshelf()