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)
#! /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'])
@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)
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)