# coding: utf-8 from apps import app from .views import * url_prefix = "/abc/123" app.add_url_rule("/index", view_func=index1, methods=[ 'GET', ], strict_slashes=False) app.add_url_rule("/app", view_func=Task.as_view("apps"), strict_slashes=False)
# coding: utf-8 from apps import app from .views import * url_prefix = "/api/application" app.add_url_rule(f"{url_prefix}s", view_func=get_all_applications, methods=['GET', ], strict_slashes=False) app.add_url_rule(f"{url_prefix}/<application_id>", view_func=ApplicationConfigs.as_view("application_config"), methods=['GET', 'POST'], strict_slashes=False) app.add_url_rule(f"{url_prefix}", view_func=Applications.as_view("application"), strict_slashes=False) app.add_url_rule(f"{url_prefix}/change", view_func=application_change_env, methods=['POST', ], strict_slashes=False)
# coding: utf-8 from apps import app from .views import * url_prefix = "/api/env" app.add_url_rule(f"{url_prefix}s", view_func=get_all_envs, methods=['GET', ], strict_slashes=False) app.add_url_rule(f"{url_prefix}/<env_id>", view_func=get_single_env, methods=['GET', ], strict_slashes=False) app.add_url_rule(f"{url_prefix}", view_func=Env.as_view("env"), strict_slashes=False) app.add_url_rule(f"{url_prefix}/change", view_func=env_change_namespcae, methods=['POST', ], strict_slashes=False)
return currency def to_date(date): return datetime.strptime(date, '%Y-%m-%d') def http_response(message, status_code): return make_response(jsonify(message=message), status_code) from apps.views.excurrencyView import ExchangeCurrencyView from apps.views.exrateView import ExchangeRateView exchange = Blueprint('app', __name__) @exchange.route('/') def root(): return 'Hello Hooman!' excurrency_view = ExchangeCurrencyView.as_view('currency_view') exrate_view = ExchangeRateView.as_view('rate_view') app.add_url_rule(EXCURRENCIES_ENDPOINT, view_func=excurrency_view, methods=['GET', 'POST', 'DELETE']) app.add_url_rule(EXRATES_ENDPOINT, view_func=exrate_view, methods=['GET', 'POST'])
""" urls.py URL dispatch route mappings and error handlers """ from flask import render_template from apps import app from apps import views # Home page app.add_url_rule('/', 'home', view_func=views.home, methods=['GET']) app.add_url_rule('/login', 'login', view_func=views.login, methods=['GET', 'POST']) app.add_url_rule('/join', 'join', view_func=views.join, methods=['GET', 'POST']) app.add_url_rule('/logout', 'logout', view_func=views.logout, methods=['GET', 'POST']) app.add_url_rule('/send_message', 'send_message', view_func=views.send_message, methods=['POST']) # # Error handlers # Handle 404 errors @app.errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 # Handle 500 errors @app.errorhandler(500) def server_error(e): return render_template('500.html'), 500
# coding: utf-8 from apps import app from .views import * url_prefix = "/api/namespaces" app.add_url_rule(f"{url_prefix}", view_func=get_list_namespaces, methods=[ 'GET', ], strict_slashes=False) app.add_url_rule("/api/namespace/<namespace_id>", view_func=get_single_namespace, methods=[ 'GET', ], strict_slashes=False) app.add_url_rule("/api/namespace", view_func=Namespace.as_view("namespace"), strict_slashes=False)