This commit is contained in:
parent
994469c2e3
commit
9a2d7b6f11
17
main.py
17
main.py
|
@ -24,15 +24,22 @@ async def dev_pid():
|
||||||
if MODE == 'development' and not exists(DEV_SERVER_PID_FILE_NAME):
|
if MODE == 'development' and not exists(DEV_SERVER_PID_FILE_NAME):
|
||||||
with open(DEV_SERVER_PID_FILE_NAME, 'w', encoding='utf-8') as f:
|
with open(DEV_SERVER_PID_FILE_NAME, 'w', encoding='utf-8') as f:
|
||||||
f.write(str(os.getpid()))
|
f.write(str(os.getpid()))
|
||||||
print(f'[main] started in {MODE} mode')
|
print(f'[main] process started in {MODE} mode')
|
||||||
|
|
||||||
routes = [
|
# main starlette app object with ariadne mounted in root
|
||||||
|
app = Starlette(
|
||||||
|
routes=[
|
||||||
Route('/', GraphQL(schema, debug=True)),
|
Route('/', GraphQL(schema, debug=True)),
|
||||||
Route('/new-author', WebhookEndpoint),
|
Route('/new-author', WebhookEndpoint),
|
||||||
]
|
],
|
||||||
app = Starlette(routes=routes, debug=True, on_startup=[
|
on_startup=[
|
||||||
redis.connect,
|
redis.connect,
|
||||||
ViewedStorage.init,
|
ViewedStorage.init,
|
||||||
search_service.info,
|
search_service.info,
|
||||||
dev_pid
|
dev_pid
|
||||||
], on_shutdown=[redis.disconnect])
|
],
|
||||||
|
on_shutdown=[
|
||||||
|
redis.disconnect
|
||||||
|
],
|
||||||
|
debug=True
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user