Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jingke_poc_demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马勇
jingke_poc_demo
Commits
e1ae301e
Commit
e1ae301e
authored
Dec 12, 2025
by
马勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parents
Pipeline
#2721
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
0 deletions
+107
-0
Dockerfile
Dockerfile
+13
-0
README.md
README.md
+52
-0
main.py
main.py
+34
-0
pyproject.toml
pyproject.toml
+8
-0
No files found.
Dockerfile
0 → 100644
View file @
e1ae301e
FROM
python:3.12-slim
WORKDIR
/app
ENV
UV_VERSION=0.9.17
RUN
pip
install
--no-cache-dir
uv
==
${
UV_VERSION
}
COPY
pyproject.toml ./
RUN
uv
sync
--no-dev
COPY
main.py main.py
RUN
mkdir
-p
uploads
EXPOSE
5000
CMD
[".venv/bin/python", "main.py"]
README.md
0 → 100644
View file @
e1ae301e
# Jingke POC Demo
这是一个基于 Flask 的简单文件上传服务的 POC (Proof of Concept) 演示项目。
## 功能说明
该应用提供了一个简单的文件上传接口,将上传的文件保存到服务器的
`uploads`
目录中。每次上传有 50% 的概率返回成功或失败状态。
## 技术栈
-
Python 3.12
-
Flask 3.1.2
-
uv 包管理工具
## 运行方式
### 本地运行
1.
安装依赖:
```
bash
pip
install
uv
uv
sync
```
2. 运行应用:
```
bash
python main.py
```
### Docker 运行
构建并运行 Docker 镜像:
```
bash
docker build -t jingke-poc-demo .
docker run -p 5000:5000 jingke-poc-demo
```
## API 接口
### 文件上传
-
**URL**
:
`/upload`
-
**方法**
: POST
-
**参数**
:
`file`
(表单数据中的文件)
-
**响应**
:
-
成功时返回 "ok"
-
失败时返回 "fail"
## 注意事项
这是一个概念验证项目,仅用于演示目的,不建议在生产环境中使用。
\ No newline at end of file
main.py
0 → 100644
View file @
e1ae301e
import
os
import
random
from
datetime
import
datetime
from
flask
import
Flask
,
request
app
=
Flask
(
__name__
)
UPLOAD_FOLDER
=
"uploads"
os
.
makedirs
(
UPLOAD_FOLDER
,
exist_ok
=
True
)
@
app
.
route
(
"/upload"
,
methods
=
[
"POST"
])
def
upload_file
():
if
"file"
not
in
request
.
files
:
return
"No file part"
file
=
request
.
files
[
"file"
]
res
=
random
.
choice
([
"ok"
,
"fail"
])
if
res
==
"fail"
:
return
res
if
file
.
filename
==
""
:
return
"No selected file"
timestamp
=
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d_
%
H
%
M
%
S"
)
save_path
=
os
.
path
.
join
(
UPLOAD_FOLDER
,
timestamp
+
'_'
+
file
.
filename
)
file
.
save
(
save_path
)
return
res
if
__name__
==
"__main__"
:
app
.
run
(
host
=
"0.0.0.0"
,
port
=
5000
,
debug
=
True
)
pyproject.toml
0 → 100644
View file @
e1ae301e
[project]
name
=
"jingke-poc-demo"
version
=
"0.1.0"
description
=
"Add your description here"
requires-python
=
">=3.12"
dependencies
=
[
"flask>=3.1.2"
,
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment