腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
如
何在
不将用户重定向到另一个页面的情况下发送
FastAPI
响应?
、
、
、
我正在使用
FastAPI
创建一个API,它从HTML页面接收form-data,处理数据(需要片刻时间)并返回一条消息,表示任务已经完成。这是我的后端:from
fastapi
import
FastAPI
, Form, Requestasync def swinir_dict_creation(
浏览 9
提问于2022-03-29
得票数 0
回答已采纳
2
回答
通过
FastAPI
部署React的构建文件夹
、
、
、
、
static/build/├── favicon.ico └── media我在frontend/build/
中
复制了现在,我想通过
FastAPI
提供这个
浏览 9
提问于2022-04-11
得票数 5
回答已采纳
1
回答
fastapi
和jinja
加载
一个html
、
、
、
我正在尝试用
FastApi
和Jinja2创建一个简单的主页。 我想要做的是进入我的主页,它
加载
一个html而不返回响应,但是我的html
加载
了。这是我非常简单的代码 "main.py“ from
fastapi
import
FastAPI
template = Jinja2Templates(directory=".
浏览 28
提问于2021-01-25
得票数 1
回答已采纳
1
回答
如
何在
本地主机上使用Fast
加载
index.html
文件?
、
、
我试过了:app.mount("", StaticFiles(directory="
index.html
", html = True), name="
index.html
")templatesdirectory="/")) def serve_home(request: Request): return templates.TemplateResponse("
index.ht
浏览 6
提问于2022-09-20
得票数 0
回答已采纳
2
回答
加载
index.html
的最小
fastapi
示例
在我的项目文件夹
中
,我有一个基本的
index.html
文件加上静态文件(js,css)以及我的main.py。from
fastapi
.staticfiles import StaticFilesfrom
fastapi
directory="/")) def serve_home(request: Request):
浏览 7
提问于2021-01-27
得票数 18
回答已采纳
1
回答
如
何在
FastAPI
中
加载
index.html
、
我在Vue
中
构建了我的应用程序,在Python中使用
FastAPI
构建了我的后台。在执行npm run build之后,我将dist文件夹复制到了templates文件夹
中
。我想
加载
index.html
,但是我得到了错误的error_aborted 404 (not found)。templates文件夹
中
包含static文件夹。为什么我会得到这个错误?from
fastapi
.staticfiles import StaticFiles from
fastap
浏览 65
提问于2021-01-10
得票数 1
回答已采纳
1
回答
与
FastAPI
一起使用时无法识别的CSS
、
、
我已经构建了一个
FastAPI
应用程序和一个索引、css和js文件,这些文件在直接打开时可以工作,但是我无法在
FastAPI
服务时显示这个css文件。如果问题是CORS问题,我尝试过故障排除,我尝试重新排列文件,以便位于相同或不同的目录
中
(并相应地重新指定href路径),但是没有什么效果。这里是我的目录:└── app ├── style.css应用程序的主页路径设置如下: file_path= "<em
浏览 2
提问于2020-05-06
得票数 10
2
回答
使用
FastAPI
和OpenCV的视频流应用程序
、
、
500 Server Error TypeError: TemplateResponse() missing 1 required positional argument: 'context'from
fastapi
import
FastAPI
from
fastapi
import Depends,
FastAPI
from
fastapi
import
FastAPI
, Request
浏览 31
提问于2020-08-31
得票数 4
1
回答
在
FastAPI
中
列出静态文件夹
中
的文件
、
我知道如
何在
FastAPI
中使用提供静态文件,如何启用目录列表,
如
Apache服务器
中
的目录列表?from
fastapi
import
FastAPI
app =
FastAPI
(...)
浏览 4
提问于2022-02-26
得票数 7
回答已采纳
1
回答
如何使用
FastAPI
提交HTML下拉列表?
、
如何使用value和
FastAPI
模板提交从下拉列表中选择的
FastAPI
?到目前为止,这是我为应用程序编写的代码:from
fastapi
.templating import Jinja2Templatesapp =
FastAPI
() @app.get(
浏览 6
提问于2022-11-19
得票数 1
5
回答
如
何在
FastAPI
中
的一条路由上捕获任意路径?
、
、
我正在服务React应用程序,它来自
FastAPI
,通过安装async def renderReactApp(request: Request): return templates.TemplateResponse("
index.html
", {&quo
浏览 10
提问于2020-07-24
得票数 38
回答已采纳
2
回答
Fastapi
: jinja2.exceptions.TemplateNotFound:
index.html
、
、
、
我正在尝试使用以下代码重定向到登录页面使用
fastapi
。我使用TemplateResponse重定向到我已经在
index.html
文件夹
中
创建的模板页面。文件结构如下- templates ->
index.html
main.pyfrom
fastapi
.responses import HTMLResponse from
fastapi<
浏览 0
提问于2021-05-24
得票数 2
1
回答
如
何在
不使用Swagger的情况下将JSON数据发布到
FastAPI
后端?
、
、
我正在尝试使用POST做一个简单的
FastAPI
操作。我使用BaseModel创建了一个基本结构,它只有两个属性,即name和roll。import uvicornfrom pydantic import BaseModel roll: int async def create_item(item:
浏览 4
提问于2022-04-04
得票数 2
3
回答
如何将后端和前端放在一起--从
fastapi
后端端点返回回响应前端
、
如果我想在本地运行和测试我的后端,因为我使用的是
FastAPI
,我只需运行uvicorn main:app --reload。但是,当然,这只是给我静态的html,没有反应组件。如
何在
域根端点返回用于GET请求的前端工作的产品?
浏览 3
提问于2020-07-16
得票数 9
1
回答
使用
FastAPI
/
fastapi
-socketio和JavaScript/socket.io.js进行双向通信-->连接错误
、
我构建了一个小演示,在FLASK
中
尝试通过WebSockets进行双向通信,效果很好。终端
中
的错误:信息:127.0.0.1:50117-找不到"GET /socket.io/?EIO=4&transport=polling&t=NeEnmWx HTTP/1.1“404
加载
资源失败:服务器响应状态为404 (未找到)轮询-xhr.js:202 获取_
浏览 15
提问于2021-06-15
得票数 1
1
回答
Fastapi
:显示erorr jinja2.exceptions.TemplateNotFound:
index.html
、
我使用TemplateResponse重定向到我已经在模板文件夹
中
创建的
index.html
页面。档案结构如下:静态-> style.cssfrom
fastapi
import
FastAPI
, Requestfrom
fastapi
.responses import HTMLResponse from
fastapi
.staticfiles import Static
浏览 10
提问于2022-08-29
得票数 0
1
回答
如何通过POST请求将JSON数据从Nuxt发送到
FastAPI
后端?
、
、
、
instead to try and send the whole json dict of user data to // backend and sort the data over in
fastapi
浏览 14
提问于2022-07-21
得票数 3
回答已采纳
4
回答
如
何在
FastAPI
中提供静态文件
、
、
、
、
我正在尝试提供package_docs目录
中
的静态文件。当我在浏览器
中
打开:但是我想打开这个页面:def root(): return HTMLResponse(pkg_resources.resource_string(__name__, "package_docs/
index.html
浏览 39
提问于2020-06-19
得票数 8
1
回答
在本地主机
中
获取用于JavaScript的
FastApi
、
、
如何使用我用
FastAPI
制作的Api,从我的本地主机,从外部html,例如,它是我测试的简单实现:from
fastapi
import
FastAPI
async def main():
index.html
:<head>由于访问控制检
浏览 1
提问于2020-09-20
得票数 0
回答已采纳
1
回答
如何使用
FastAPI
将视频帧和文本返回到HTML页面?
、
、
、
、
FastAPI
代码 while True: if not
浏览 8
提问于2022-04-30
得票数 1
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
对象存储
云点播
实时音视频
活动推荐
运营活动
广告
关闭
领券