mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
Verifying that root_api is imported before starting WROLPi API.
This commit is contained in:
parent
41f3969330
commit
023dfc68e0
1 changed files with 5 additions and 0 deletions
5
main.py
5
main.py
|
|
@ -8,6 +8,7 @@ from sanic import Sanic
|
|||
from sanic.signals import Event
|
||||
|
||||
from wrolpi import flags, BEFORE_STARTUP_FUNCTIONS, admin
|
||||
from wrolpi import root_api # noqa
|
||||
from wrolpi import tags
|
||||
from wrolpi.api_utils import api_app
|
||||
from wrolpi.common import logger, check_media_directory, set_log_level, limit_concurrent, \
|
||||
|
|
@ -148,6 +149,10 @@ async def startup(app: Sanic):
|
|||
|
||||
check_media_directory()
|
||||
|
||||
if ('api',) not in app.router.routes_all:
|
||||
logger.debug(f'{app.router.routes_all=}')
|
||||
raise RuntimeError('WROLPi routes do not exist! Was root_api imported?')
|
||||
|
||||
# Initialize multiprocessing shared contexts before forking Sanic processes.
|
||||
attach_shared_contexts(app)
|
||||
logger.debug('startup done')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue