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)
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
def create_app(debug=True): log_config = LOGGING if not debug else None app = Sanic(PROJECT_ID, log_config=log_config) app.debug = debug app.config.update(SANIC_SETTINGS) app.http = http # Static files app.static('/static', './app/templates/static') # Set routes app.add_route(index, '/index') app.add_route(RoomView.as_view(), '/room') app.add_route(UserView.as_view(), '/user') app.add_websocket_route(handler=web_socket_chat, uri="chat") # Register listener app.register_listener(before_server_start, 'before_server_start') app.register_listener(after_server_stop, 'after_server_stop') # Register middleware app.register_middleware(token_middleware) app.register_middleware(cookie_middleware, 'response') app.blueprint(SANIC_BLUEPRINT) logging.info('Creating sanic app') MainSetup._app = app return app
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
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
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)
from django.urls import path from rest_framework.urlpatterns import format_suffix_patterns # from rest_framework.authtoken import views from app.views.notification import NotificationResource from app.views.user import UserView, UserAuthorizeView, UserDetail from app.views.sms_email import Email from app.views.withdraw import ListWithdraw, RetrieveWithdraw urlpatterns = [ path(r'user/', UserDetail.as_view()), path(r'register/', UserView.as_view()), path(r'login/', UserAuthorizeView.as_view()), path(r'email/', Email.as_view()), path(r'withdraw/', ListWithdraw.as_view()), path(r'withdraw/<int:pk>/', RetrieveWithdraw.as_view()), path(r'notification/', NotificationResource.as_view()), ] urlpatternsk = format_suffix_patterns(urlpatterns)