feat: 新增技能扩展N7一章相关示例源码
This commit is contained in:
11
code/newsletter/N7/templates/inheritance/base.md
Normal file
11
code/newsletter/N7/templates/inheritance/base.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# {% block title %}{% endblock %}
|
||||
|
||||
Your environment:
|
||||
|
||||
{% block environment %}{% endblock %}
|
||||
|
||||
---
|
||||
|
||||
Bug detail:
|
||||
|
||||
{% block description %}{% endblock %}
|
||||
15
code/newsletter/N7/templates/inheritance/bug_report.md
Normal file
15
code/newsletter/N7/templates/inheritance/bug_report.md
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "base.md" %}
|
||||
|
||||
{% block title %}
|
||||
{{ title }}
|
||||
{% endblock %}
|
||||
|
||||
{% block environment %}
|
||||
{% for item in setup %}
|
||||
- {{ item.name }}: {{ item.detail }}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block description %}
|
||||
{{ description }}
|
||||
{% endblock %}
|
||||
18
code/newsletter/N7/templates/project/main.py.jinja2
Normal file
18
code/newsletter/N7/templates/project/main.py.jinja2
Normal file
@@ -0,0 +1,18 @@
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
|
||||
from {{ app_name }}.views import router
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def index():
|
||||
return {"msg": "index"}
|
||||
|
||||
|
||||
app.include_router(router)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
uvicorn.run(app)
|
||||
8
code/newsletter/N7/templates/project/views.py.jinja2
Normal file
8
code/newsletter/N7/templates/project/views.py.jinja2
Normal file
@@ -0,0 +1,8 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter(prefix="/{{ app_name }}/api")
|
||||
|
||||
|
||||
@router.get("/")
|
||||
async def index():
|
||||
return {"msg": "Hello, world"}
|
||||
36
code/newsletter/N7/templates/web/base.html
Normal file
36
code/newsletter/N7/templates/web/base.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
<style>
|
||||
.app {
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
font-size: 1.5rem;
|
||||
width: 1080px;
|
||||
}
|
||||
.halo {
|
||||
font-weight: 600;
|
||||
font-size: 2rem;
|
||||
}
|
||||
.data {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.data th, .data td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
<p class="halo">👋 Halo! Welcome to my website!</p>
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
13
code/newsletter/N7/templates/web/index.html
Normal file
13
code/newsletter/N7/templates/web/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}
|
||||
{{ "Index" }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block body %}
|
||||
|
||||
<main>
|
||||
<p>Life is short, You need Python!</p>
|
||||
</main>
|
||||
|
||||
{% endblock %}
|
||||
33
code/newsletter/N7/templates/web/user.html
Normal file
33
code/newsletter/N7/templates/web/user.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}
|
||||
{{ "User" }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block body %}
|
||||
|
||||
<main>
|
||||
{% if users %}
|
||||
<p>Users: </p>
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Id</th>
|
||||
<th scope="col">Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr scope="row">
|
||||
<td>{{ user.id }}</td>
|
||||
<td class="name">{{ user.name }}</td>
|
||||
</tr>
|
||||
{% endfor%}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>Whoops! Do you not seem to add any user?</p>
|
||||
{% endif%}
|
||||
</main>
|
||||
|
||||
{% endblock %}
|
||||
BIN
code/newsletter/N7/templates/word/base.docx
Normal file
BIN
code/newsletter/N7/templates/word/base.docx
Normal file
Binary file not shown.
BIN
code/newsletter/N7/templates/word/mars-cover.jpg
Normal file
BIN
code/newsletter/N7/templates/word/mars-cover.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 406 KiB |
Reference in New Issue
Block a user