Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to accommodate for before_app_first_request method deprecation #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"project_name": "restful_api",
"app_name": "myapi",
"python_version": ["3.8", "3.7", "3.6"],
"python_version": ["3.11", "3.10", "3.9", "3.8"],
"tox_python_env": "py{{ cookiecutter.python_version|replace('.','') }}",
"use_celery": ["no", "yes"],
"admin_user_username": "admin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
api.add_resource(UserList, "/users", endpoint="users")


@blueprint.before_app_first_request
def register_views():
apispec.spec.components.schema("UserSchema", schema=UserSchema)
apispec.spec.path(view=UserResource, app=current_app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def create_app(testing=False):

configure_extensions(app)
configure_cli(app)
configure_apispec(app)
register_blueprints(app)
configure_apispec(app)
{%- if cookiecutter.use_celery == "yes" %}
init_celery(app)
{%- endif %}
Expand Down Expand Up @@ -58,6 +58,9 @@ def configure_apispec(app):
}
},
)
with app.app_context():
api.views.register_views()
auth.views.register_views()


def register_blueprints(app):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def check_if_token_revoked(jwt_headers, jwt_payload):
return is_token_revoked(jwt_payload)


@blueprint.before_app_first_request
def register_views():
apispec.spec.path(view=login, app=app)
apispec.spec.path(view=refresh, app=app)
Expand Down