[英]FastAPI pending request when deployed GCP App Engine
I'm deployed a FastAPI app to the GCP app engine.我已将 FastAPI 应用程序部署到 GCP 应用程序引擎。 However, I'm getting a HTTP Status Code 500 which's an internal server error and I checked the problem and found out that the favicon.ico is pending all the time.
但是,我收到 HTTP 状态代码 500,这是一个内部服务器错误,我检查了问题,发现 favicon.ico 一直处于挂起状态。 What solution could I make to prevent the favicon.ico from pending?
我可以采取什么解决方案来防止 favicon.ico 挂起?
Note: The front-end is React and fetching data using Fetch - Github react app link: https://github.com/SaudC21/simple-react-app注意:前端是 React 并使用 Fetch 获取数据 - Github react app 链接: https://github.com/SaudC21/simple-react-app
Here is my FastAPI code:这是我的 FastAPI 代码:
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = [
"http://localhost:3000",
"https://simple-react-fastapi-app.oa.r.appspot.com/",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get('/')
def root():
return {"Hello World, From Server!"}
This is my app.yaml code:这是我的 app.yaml 代码:
runtime: python310
entrypoint: uvicorn main:app --reload
maybe the response should be a dict, can you try with也许响应应该是一个字典,你可以试试
return {"Hello World": "From Server!"}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.