Example #1
0
def make_app():
    try:
        import local_settings
        settings.update(local_settings.settings)
    except Exception as e:
        logging.error("read local_settings fail")
        pass

    init_calibre()

    import handlers
    from calibre.db.legacy import LibraryDatabase

    auth_db_path = settings['user_database']
    logging.info("Init library with [%s]" % options.with_library)
    logging.info("Init AuthDB  with [%s]" % auth_db_path)
    logging.info("Init Static  with [%s]" % settings['static_path'])
    logging.info("Init LANG    with [%s]" % P('localization/locales.zip'))
    book_db = LibraryDatabase(os.path.expanduser(options.with_library))
    cache = book_db.new_api

    Base = declarative_base()
    engine = create_engine(auth_db_path, echo=False)
    session = scoped_session(
        sessionmaker(bind=engine, autoflush=True, autocommit=False))
    init_social(Base, session, settings)
    models.bind_session(session)

    load_calibre_translations()

    if options.syncdb:
        models.user_syncdb(engine)
        sys.exit(0)

    if options.test:
        from test import email
        email.do_send_mail()
        sys.exit(0)

    settings.update({
        "legacy": book_db,
        "cache": cache,
        "session": session,
    })

    return web.Application(SOCIAL_AUTH_ROUTES + handlers.routes(), **settings)
Example #2
0
def syncdb():
    from models import User
    init_social(Base, session, tornado_settings)
    Base.metadata.create_all(engine)
Example #3
0
def syncdb():
    from models import User

    init_social(Base, session, tornado_settings)
    Base.metadata.create_all(engine)
Example #4
0
def main():
    init_social(Base, session, tornado_settings)
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(8000)
    tornado.ioloop.IOLoop.instance().start()
Example #5
0
def main():
    init_social(Base, session, tornado_settings)
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(8000)
    tornado.ioloop.IOLoop.instance().start()