def create_app(self): app = create_app("OOZero.config.TestingConfig") return app
from OOZero import create_app from flask import Flask, render_template, request, redirect, url_for, session, flash from OOZero.user_model import authenticateUser, addUser, hashPassword, getUser, editUser from OOZero.user_session import login_required, user_login, user_logout from OOZero.event_blueprint import events app = create_app() app.register_blueprint(events, url_prefix='/events') @app.route('/') #@login_required def home(): try: if session['username']: return render_template('home.html', username=session['username']) return render_template('home.html') except: session['username'] = None return render_template('home.html') @app.route('/login/', methods=['POST', 'GET']) def login(): error = None if request.method == 'POST': # Authenticate the given user with this username and password username = request.form['username'] password = request.form['password'] user = authenticateUser(username, password) if user:
event.createEvent(name="its on a page", owner=user.getUser("username").id, event_type=event.EventType.NOTE, page=page1) if __name__ == "__main__": parser = argparse.ArgumentParser( description="Generate OOZero sqlite database") parser.add_argument( '-c', type=str, metavar='CONFIG', default="DevelopmentConfig", help= "Which set of settings found under OOZero/config.py to load, determins db name and location" ) parser.add_argument( '-g', type=bool, metavar='GENERATE', default=False, help='Generate dummy data for testing, defaults to False') args = parser.parse_args() app = create_app("OOZero.config." + args.c) with app.app_context(): if args.g: generatePopulateDB() else: generateDB()