不知道我设置错了什么,但在 uvicorn 中运行时我没有得到 graphiql 界面uvicorn mysite.asgi:application
:
[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'
}