#application.register_blueprint(front) #application.register_blueprint(api) runserver = lambda host,port,app: run_simple(host,port,app,use_debugger=True,use_reloader=True) if not os.environ.get('TESTING'): from gevent.pywsgi import WSGIServer run_server = lambda host,port,app: WSGIServer((host,port),app).serve_forever() #front.config['DATABASE_URI'] = 'sqlite:///test3.db' #api.config['DATABASE_URI'] = 'sqlite:///test3.db' #application = DispatcherMiddleware(front,{ # '/api/v1':api #}) application = get_app('app',blueprints=dict(api=api,front=front)) if __name__ == "__main__": application.wsgi_app = HTMLMinMiddleware(application.wsgi_app) @application.before_first_request def set_secret(): application.config['SECRET_KEY'] = make_secret_key() port = int(os.environ.get('PORT') or 8000) args = ['',port,application] run_server(*args)
def create_app(self): app = get_app('app', cfg='test', blueprints=dict(api=api, front=front)) app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False return app
def setUp(self): self.app = app_factory.get_app() with self.app.app_context(): db.init_app(self.app) db.drop_all() db.create_all() # Creating test users new_user_1 = User( name="Sergio", email="*****@*****.**", dci="12345678", active=True, verified=False, last_login=datetime.now() ) new_user_2 = User( name="Rosca", email="*****@*****.**", dci="910111213", active=True, verified=False, last_login=datetime.now() ) # Creating test characters new_character_1 = Character( name="Tinemir", ) new_character_2 = Character( name="Uther", ) new_character_3 = Character( name="Rosquette", ) # Creating test items new_item_1 = Item( name="Magic Sword", type_="Weapon", rarity="Unique", attuned=True, notes="Bleeds", source="DMG" ) new_item_2 = Item( name="Magic Staff", type_="Weapon", rarity="Rare", attuned=True, notes="Bleeds", source="DMG" ) new_item_3 = Item( name="Magic beads", type_="Weapon", rarity="Uncommon", attuned=True, notes="Bleeds", source="DMG" ) # Commiting all objects to DB new_character_1.items.append(new_item_1) new_character_1.items.append(new_item_2) new_character_3.items.append(new_item_3) new_user_1.characters.append(new_character_1) new_user_1.characters.append(new_character_2) new_user_2.characters.append(new_character_3) db.session.add(new_user_1) db.session.add(new_user_2) db.session.commit() # Creating Offers new_offer_1 = Offer( offered_item=new_item_1.item_id, wanted_item=new_item_3.item_id, date_created=datetime.now(), ) db.session.add(new_offer_1) db.session.commit()
def create_app(self): app = get_app('app',cfg='test',blueprints=dict(api=api,front=front)) app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False return app
def create_app(self): return get_app('app',cfg='test',blueprints=dict(api=api,front=front))
import app_factory import dao import login application = app_factory.get_app() dao.db.init_app(application) login.login_manager.init_app(application)
#application.register_blueprint(front) #application.register_blueprint(api) runserver = lambda host, port, app: run_simple( host, port, app, use_debugger=True, use_reloader=True) if not os.environ.get('TESTING'): from gevent.pywsgi import WSGIServer run_server = lambda host, port, app: WSGIServer( (host, port), app).serve_forever() #front.config['DATABASE_URI'] = 'sqlite:///test3.db' #api.config['DATABASE_URI'] = 'sqlite:///test3.db' #application = DispatcherMiddleware(front,{ # '/api/v1':api #}) application = get_app('app', blueprints=dict(api=api, front=front)) if __name__ == "__main__": application.wsgi_app = HTMLMinMiddleware(application.wsgi_app) @application.before_first_request def set_secret(): application.config['SECRET_KEY'] = make_secret_key() port = int(os.environ.get('PORT') or 8000) args = ['', port, application] run_server(*args)