Skip to content

Commit

Permalink
lazy load admin api for Starlette and Django (#1886) (#1900)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis authored Jan 14, 2025
1 parent 2402fe0 commit b4d3535
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit b4d3535

Please sign in to comment.