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

lazy load admin api for Starlette and Django (#1886) #1900

Merged
merged 1 commit into from
Jan 14, 2025
Merged
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
6 changes: 4 additions & 2 deletions pygeoapi/django_/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Copyright (c) 2022 Francesco Bartoli
# Copyright (c) 2022 Luca Delucchi
# Copyright (c) 2022 Krishna Lodha
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2025 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -49,7 +49,9 @@
import pygeoapi.api.processes as processes_api
import pygeoapi.api.stac as stac_api
import pygeoapi.api.tiles as tiles_api
import pygeoapi.admin as admin_api

if settings.PYGEOAPI_CONFIG['server'].get('admin'):
import pygeoapi.admin as admin_api


def landing_page(request: HttpRequest) -> HttpResponse:
Expand Down
4 changes: 2 additions & 2 deletions pygeoapi/starlette_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Abdulazeez Abdulazeez Adeshina <[email protected]>
#
# Copyright (c) 2020 Francesco Bartoli
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2025 Tom Kralidis
# Copyright (c) 2022 Abdulazeez Abdulazeez Adeshina
#
# Permission is hereby granted, free of charge, to any person
Expand Down Expand Up @@ -58,7 +58,6 @@
import pygeoapi.api.processes as processes_api
import pygeoapi.api.stac as stac_api
import pygeoapi.api.tiles as tiles_api
import pygeoapi.admin as admin_api
from pygeoapi.openapi import load_openapi_document
from pygeoapi.config import get_config
from pygeoapi.util import get_api_rules
Expand All @@ -71,6 +70,7 @@
OPENAPI = load_openapi_document()

if CONFIG['server'].get('admin'):
import pygeoapi.admin as admin_api
from pygeoapi.admin import Admin

p = Path(__file__)
Expand Down