gpt4 book ai didi

graphene-django - 从 Uvicorn 运行时未加载 Django graphene GraphiQL 页面

转载 作者:行者123 更新时间:2023-12-05 05:04:03 53 4
gpt4 key购买 nike

不确定我设置错了什么,但是当我使用 uvicorn mysite.asgi:application 在 uvicorn 中运行时,我没有得到 graphiql 界面:

[32mINFO[0m:     Started server process [[36m14872[0m]
[32mINFO[0m: Waiting for application startup.
[32mINFO[0m: ASGI 'lifespan' protocol appears unsupported.
[32mINFO[0m: Application startup complete.
[32mINFO[0m: Uvicorn running on [1mhttp://127.0.0.1:8000[0m (Press CTRL+C to quit)
[32mINFO[0m: 127.0.0.1:52463 - "GET /graphql/ HTTP/1.1" 200
Not Found: /static/graphene_django/graphiql.js
[33mWARNING[0m: Not Found: /static/graphene_django/graphiql.js
[32mINFO[0m: 127.0.0.1:52463 - "GET /static/graphene_django/graphiql.js HTTP/1.1" 404
Not Found: /static/graphene_django/graphiql.js
[33mWARNING[0m: Not Found: /static/graphene_django/graphiql.js
[32mINFO[0m: 127.0.0.1:52463 - "GET /static/graphene_django/graphiql.js HTTP/1.1" 404

但是当我执行 python manage.py runserver

时它加载正常

这是我安装的:

Python 3.8.2
Django==3.0.5
uvicorn==0.11.3
graphene==2.1.8
graphene-django==2.9.0
graphql-core==2.3.1

在 settings.py 中我有:

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),]

# Graphene
GRAPHENE = {
'SCHEMA': 'mysite.schema.schema'
}

最佳答案

只需在 settings.py 文件中设置 DEBUG = True。

关于graphene-django - 从 Uvicorn 运行时未加载 Django graphene GraphiQL 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61286482/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com