try: import psycopg2 except ImportError: # Fall back to psycopg2cffi from psycopg2cffi import compat compat.register() from apistar_jwt import JWT from apistar_mail import MailComponent from sqlalchemy import create_engine from cookie_api import application_factory from cookie_api.util import SQLAlchemySession, SQLAlchemyHook from config import db_config, jwt_config, mail_config components = [ SQLAlchemySession(create_engine(db_config)), JWT(jwt_config), MailComponent(**mail_config) ] hooks = [ SQLAlchemyHook() ] app = application_factory(components=components, hooks=hooks) def main(): app.serve('0.0.0.0', 5000, debug=True) if __name__ == '__main__': main()