コード例 #1
0
ファイル: runserver.py プロジェクト: sabite/newspipe
application.jinja_env.filters['datetime'] = format_datetime
application.jinja_env.globals['conf'] = conf

# Views
from flask_restful import Api
from flask import g

with application.app_context():
    populate_g()
    g.api = Api(application, prefix='/api/v2.0')
    g.babel = babel

    from web import views
    application.register_blueprint(views.articles_bp)
    application.register_blueprint(views.article_bp)
    application.register_blueprint(views.feeds_bp)
    application.register_blueprint(views.feed_bp)
    application.register_blueprint(views.categories_bp)
    application.register_blueprint(views.category_bp)
    application.register_blueprint(views.icon_bp)
    application.register_blueprint(views.admin_bp)
    application.register_blueprint(views.users_bp)
    application.register_blueprint(views.user_bp)
    application.register_blueprint(views.bookmarks_bp)
    application.register_blueprint(views.bookmark_bp)

if __name__ == '__main__':
    application.run(host=conf.WEBSERVER_HOST,
                    port=conf.WEBSERVER_PORT,
                    debug=False)
コード例 #2
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-

from bootstrap import application, populate_g

with application.app_context():
    populate_g()

    from web import views

    # API v1
    application.register_blueprint(views.api.v1.api_bp)

if __name__ == '__main__':
    application.run(host=application.config['HOST'],
                    port=application.config['PORT'])
コード例 #3
0
ファイル: runserver.py プロジェクト: blatinier/JARR
@babel.timezoneselector
def get_timezone():
    try:
        return conf.TIME_ZONE[get_locale()]
    except:
        return conf.TIME_ZONE["en"]

# Jinja filters
application.jinja_env.filters['month_name'] = lambda n: calendar.month_name[n]
application.jinja_env.globals['conf'] = conf

# Views
with application.app_context():
    from web import views
    application.register_blueprint(views.articles_bp)
    application.register_blueprint(views.article_bp)
    application.register_blueprint(views.feeds_bp)
    application.register_blueprint(views.feed_bp)
    application.register_blueprint(views.categories_bp)
    application.register_blueprint(views.category_bp)
    application.register_blueprint(views.icon_bp)
    application.register_blueprint(views.admin_bp)
    application.register_blueprint(views.users_bp)
    application.register_blueprint(views.user_bp)


if __name__ == '__main__':  # pragma: no cover
    application.run(host=conf.WEBSERVER_HOST,
                    port=conf.WEBSERVER_PORT,
                    debug=True)
コード例 #4
0
application.jinja_env.globals['conf'] = conf

# Views
from flask_restful import Api
from flask import g

with application.app_context():
    populate_g()
    g.api = Api(application, prefix='/api/v2.0')
    g.babel = babel

    from web import views
    application.register_blueprint(views.articles_bp)
    application.register_blueprint(views.article_bp)
    application.register_blueprint(views.feeds_bp)
    application.register_blueprint(views.feed_bp)
    application.register_blueprint(views.categories_bp)
    application.register_blueprint(views.category_bp)
    application.register_blueprint(views.icon_bp)
    application.register_blueprint(views.admin_bp)
    application.register_blueprint(views.users_bp)
    application.register_blueprint(views.user_bp)
    application.register_blueprint(views.bookmarks_bp)
    application.register_blueprint(views.bookmark_bp)


if __name__ == '__main__':
    application.run(host=conf.WEBSERVER_HOST,
                    port=conf.WEBSERVER_PORT,
                    debug=conf.WEBSERVER_DEBUG)