예제 #1
0
def register_api(app):
    UserView.register(app, route_base='/users', trailing_slash=False)
    BoardView.register(app, route_base='/boards', trailing_slash=False)
    PostView.register(app,
                      route_base='/boards/<board_id>/posts',
                      trailing_slash=False)
    CommentView.register(
        app,
        route_base='/boards/<board_id>/posts/<post_id>/comments',
        trailing_slash=False)
    MainView.register(app, route_base='/main', trailing_slash=False)

    register_error_handlers(app)
예제 #2
0
def init_views(flask_app, config):
    """ Initialize views. """

    from app.views.api_index import ApiIndexView
    ApiIndexView.register(flask_app, route_base='/api/')

    from app.views.authenticate import AuthenticationView
    AuthenticationView.register(flask_app, route_base='/api/authentication/')

    from app.views.configuration import ConfigurationView
    ConfigurationView.register(flask_app, route_base='/api/configuration/')

    from app.views.proxies import ProxiesView
    ProxiesView.register(flask_app, route_base='/api/proxies/')

    from app.views.file import FileView
    FileView.register(flask_app, route_base='/api/files/')

    from app.views.notification import NotificationView
    NotificationView.register(flask_app, route_base='/api/notification/')
    flask_app.atexit(NotificationView.quit_notifications)

    from app.views.site import SiteView
    SiteView.register(flask_app, route_base='/api/sites/')

    from app.views.tasks import TasksView
    TasksView.register(flask_app, route_base='/api/tasks/')

    from app.views.user import UserView
    UserView.register(flask_app, route_base='/api/users/')

    from app.views.username import UsernameView
    UsernameView.register(flask_app, route_base='/api/username/')

    from app.views.category import CategoryView
    CategoryView.register(flask_app, route_base='/api/categories/')

    from app.views.archive import ArchiveView
    ArchiveView.register(flask_app, route_base='/api/archives/')

    from app.views.result import ResultView
    ResultView.register(flask_app, route_base='/api/results/')

    from app.views.checkout import CheckoutView
    CheckoutView.register(flask_app, route_base='/api/checkout/')

    # Make sure to import the Angular view last so that it will match
    # all remaining routes.
    import app.views.angular
예제 #3
0
def init_views(flask_app, config):
    """ Initialize views. """

    from app.views.api_index import ApiIndexView
    ApiIndexView.register(flask_app, route_base='/api/')

    from app.views.authenticate import AuthenticationView
    AuthenticationView.register(flask_app, route_base='/api/authentication/')

    from app.views.configuration import ConfigurationView
    ConfigurationView.register(flask_app, route_base='/api/configuration/')

    from app.views.file import FileView
    FileView.register(flask_app, route_base='/api/file/')

    from app.views.notification import NotificationView
    NotificationView.register(flask_app, route_base='/api/notification/')
    flask_app.atexit(NotificationView.quit_notifications)

    from app.views.profile import ProfileView
    ProfileView.register(flask_app, route_base='/api/profile/')

    from app.views.search import SearchView
    SearchView.register(flask_app, route_base='/api/search/')

    from app.views.tasks import TasksView
    TasksView.register(flask_app, route_base='/api/tasks/')

    from app.views.user import UserView
    UserView.register(flask_app, route_base='/api/user/')

    from app.views.label import LabelView
    LabelView.register(flask_app, route_base='/api/label/')

    from app.views.intents import IntentsView
    IntentsView.register(flask_app, route_base='/api/intents/')

    from app.views.note import ProfileNoteView
    ProfileNoteView.register(flask_app, route_base='/api/note/')

    # Make sure to import the Angular view last so that it will match
    # all remaining routes.
    import app.views.angular
예제 #4
0
def init_views(flask_app, config):
    """ Initialize views. """

    from app.views.api_index import ApiIndexView
    ApiIndexView.register(flask_app, route_base='/api/')

    from app.views.authenticate import AuthenticationView
    AuthenticationView.register(flask_app, route_base='/api/authentication/')

    from app.views.configuration import ConfigurationView
    ConfigurationView.register(flask_app, route_base='/api/configuration/')

    from app.views.file import FileView
    FileView.register(flask_app, route_base='/api/file/')

    from app.views.notification import NotificationView
    NotificationView.register(flask_app, route_base='/api/notification/')
    flask_app.atexit(NotificationView.quit_notifications)

    from app.views.profile import ProfileView
    ProfileView.register(flask_app, route_base='/api/profile/')

    from app.views.search import SearchView
    SearchView.register(flask_app, route_base='/api/search/')

    from app.views.tasks import TasksView
    TasksView.register(flask_app, route_base='/api/tasks/')

    from app.views.user import UserView
    UserView.register(flask_app, route_base='/api/user/')

    from app.views.label import LabelView
    LabelView.register(flask_app, route_base='/api/label/')

    from app.views.intents import IntentsView
    IntentsView.register(flask_app, route_base='/api/intents/')

    # Make sure to import the Angular view last so that it will match
    # all remaining routes.
    import app.views.angular
예제 #5
0
    g.user = None
    g.error = None
    g.latest_cast = Bongcasts.query.order_by(Bongcasts.id.desc()).first()
    g.page_title = application.config.get('PAGE_TITLE')

    if 'user_id' in session:
        g.user = User.query.filter_by(id=session['user_id']).first()


@application.route('/favicon.ico')
def favicon():
    return send_from_directory(os.path.join(application.root_path, 'static'),
                               'favicon.ico', mimetype='image/vnd.microsoft.icon')

@application.route('/robots.txt')
def robots_from_static():
    return send_from_directory(os.path.join(application.root_path, 'static'),
                                'robots.txt')

from app.views.user import UserView
from app.views.cast import CastView
from app.views.generic import GenericView
from app.views.link import LinkView
from app.views.api import ApiView

UserView.register(application)
CastView.register(application)
GenericView.register(application)
LinkView.register(application)
ApiView.register(application)