Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
46c2c770
Commit
46c2c770
authored
Nov 23, 2020
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模版
parent
02332f0a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
229 additions
and
10 deletions
+229
-10
__main__.py
app/api/__main__.py
+2
-1
app.py
app/api/app.py
+4
-2
order.py
app/controller/order.py
+13
-5
version1.py
app/router/version1.py
+3
-2
__init__.py
app/templates/__init__.py
+9
-0
student.html
app/templates/student.html
+21
-0
tamp_course_order.log
logs/tamp_course_order.log
+177
-0
No files found.
app/api/__main__.py
View file @
46c2c770
...
...
@@ -9,4 +9,5 @@
from
app.api.app
import
app
if
__name__
==
'__main__'
:
app
.
run
(
'127.0.0.1'
,
port
=
8000
)
app
.
run
(
'127.0.0.1'
,
port
=
8000
,
debug
=
True
)
app/api/app.py
View file @
46c2c770
...
...
@@ -9,7 +9,9 @@
from
flask
import
Flask
from
flask_restful
import
Api
from
app.router.version1
import
add_route
from
app.api.engine
import
work_dir
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
,
template_folder
=
work_dir
+
'/app/templates'
)
api
=
Api
(
app
)
add_route
(
api
)
app/controller/order.py
View file @
46c2c770
...
...
@@ -7,7 +7,8 @@
# @Software : PyCharm
# -----------------------------------------------------------------------------
from
flask_restful
import
Resource
,
reqparse
from
flask
import
request
from
flask
import
request
,
render_template
from
flask
import
make_response
class
OrderHandlers
(
Resource
):
...
...
@@ -19,10 +20,17 @@ class OrderHandlers(Resource):
def
get
(
self
):
"""."""
self
.
parser
.
add_argument
(
'product_id'
,
type
=
str
,
required
=
True
,
help
=
'商品ID不能为空'
)
args
=
self
.
parser
.
parse_args
()
print
(
args
)
return
{
'data'
:
'world'
}
# self.parser.add_argument('product_id',type=str,required=True,help='商品ID不能为空')
# args = self.parser.parse_args()
STUDENT_LIST
=
[
{
'name'
:
'pj'
,
'age'
:
38
,
'gender'
:
'中'
},
{
'name'
:
'lc'
,
'age'
:
73
,
'gender'
:
'男'
},
{
'name'
:
'fy'
,
'age'
:
84
,
'gender'
:
'女'
}
]
params
=
{
'a'
:
'hello'
,
'b'
:
'world'
}
resp
=
make_response
(
render_template
(
'student.html'
,
student
=
STUDENT_LIST
,
params
=
params
))
resp
.
headers
[
'Content-Type'
]
=
'text/html'
return
resp
def
post
(
self
):
"""."""
...
...
app/router/version1.
0.
py
→
app/router/version1.py
View file @
46c2c770
...
...
@@ -7,7 +7,8 @@
# @Software : PyCharm
# -----------------------------------------------------------------------------
from
app.api.app
import
api
from
app.controller.order
import
*
api
.
add_resource
(
OrderHandlers
,
'/tamp_course_order/order'
)
def
add_route
(
api
):
"""注册路由"""
api
.
add_resource
(
OrderHandlers
,
'/tamp_course_order/order'
)
app/templates/__init__.py
0 → 100644
View file @
46c2c770
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name : __init__.py.py
# @Time : 2020/11/23 下午2:54
# @Author : X. Peng
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
app/templates/student.html
0 → 100644
View file @
46c2c770
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Old Boy EDU
</title>
</head>
<body>
Welcome to Old Boy EDU
{{params.a}}{{params.b}}
<div>
{{ student }}
</div>
<table
border=
"1xp"
>
{% for foo in student %}
<tr>
<td>
{{ foo.name }}
</td>
<td>
{{ foo.get("age") }}
</td>
<td>
{{ foo["gender"] }}
</td>
</tr>
{% endfor %}
</table>
</body>
</html>
\ No newline at end of file
logs/tamp_course_order.log
View file @
46c2c770
This diff is collapsed.
Click to expand it.
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