简体   繁体   English

部署 GCP App Engine 时的 FastAPI 待处理请求

[英]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.

相关问题 React 应用程序在部署到 GCP 时出现 404 错误 - React app giving 404 error when deployed to GCP 使用 javascript 部署到 Google App Engine 时,documentPath 不是有效的资源路径 - documentPath is not a valid resource path when deployed to Google App Engine with javascript 部署到 App Engine 时,由“npm run build”构建的反应应用程序未加载图像源 - react app built by `npm run build` is not loading image source when deployed to App Engine 在 GCP App Engine 上使用代码拆分部署应用程序 - 加载块 * 失败 - Deploying an App with Code Splitting on GCP App Engine - Loading chunk * failed 如何在 GCP App Engine 上同时部署 Spring 启动和 React 应用程序? - How to deploy Spring boot and React application together on GCP App Engine? 如何通过 GCP App Engine 上的 HTTP 在 React 中获取外部 API - How to fetch an outside API in React through HTTP on GCP App Engine App Engine 上部署的 React Webapp 显示空白页面 - React Webapp deployed on App Engine displays blank page CORS 策略:在 Nginx 服务器上部署 NextJS 应用程序时出现“Access-Control-Allow-Origin”问题,尝试向本地 Express 服务器发出 GET 请求 - CORS policy: The 'Access-Control-Allow-Origin' problem when deployed NextJS app on Nginx server tries GET request to local Express server 在生产中部署反应应用程序时 CSS 不完整 - CSS not complete when react app deployed in production 部署到AWS时React应用程序路由问题 - React app routes issue when deployed to AWS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM