更新一些细节

This commit is contained in:
MarkusJoe
2022-04-05 17:56:46 +08:00
parent df203fe135
commit cbf311ba6a
6 files changed
+46 -51

No files matched your search

+1 -25
View File
@@ -8,31 +8,7 @@
from flask import Flask
from .main import main
class Config:
JSON_SORT_KEYS = False
JSON_AS_ASCII = False
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
class ProductionConfig(Config):
DEBUG = False
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'default': ProductionConfig
}
from app.config import config
def create_app(config_name):
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/4/5
# @File Name: config.py
class Config:
JSON_SORT_KEYS = False
JSON_AS_ASCII = False
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
class ProductionConfig(Config):
DEBUG = False
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'default': ProductionConfig
}
+1 -1
View File
@@ -26,8 +26,8 @@ def index():
return render_template('index.html', remote_address=request.remote_addr)
@main.route('/api/v1/<string:name>', methods=['GET', 'POST'])
@main.route('/count/<string:name>', methods=['GET', 'POST'])
@main.route('/api/v1/<string:name>', methods=['GET', 'POST'])
def api_v1(name: str):
length = request.args.get('length', type=int)
theme = request.args.get('theme', type=str)
+6
View File
@@ -0,0 +1,6 @@
.intro{
text-align: center;
}
a {
color: green;
}
+7 -14
View File
@@ -4,30 +4,23 @@
<meta charset="UTF-8">
<title>Request Counter | {{ remote_address }}</title>
<link href="{{ url_for('static', filename='favicon.ico') }}" rel="shortcut icon">
<style>
.intro{
text-align: center;
}
a{
color: green;
}
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='index.css') }}">
</head>
<body>
<div class="intro">
<div class="normal-text">
<div class="normal_text">
<i>看到这句话就说明程序正常运行啦!! <a href="https://markusjoe.github.io/RequestCounter/" target="_blank">查看文档</a></i>
</div>
<div class="normal-text">
<div class="normal_text">
<i>服务端使用Flask开发没有使用异步编程</i>
</div>
<div class="normal-text">
<i><a href="/api/v1/test-example">快速查看当前示例试用例</a></i>
<div class="current_deployment_test">
<i><a href="{{ url_for('main.api_v1', name='test-example') }}">快速查看当前示例试用例</a></i>
</div>
<div class="normal-text">
<div class="remote_deployment_test">
<i><a href="https://requestcounter.herokuapp.com/count/test-example">点击查看已部署好的调用示例</a></i>
</div>
<div class="normal-text">
<div class="note">
<i><b>注: 调用支持POST 和 GET 方法请求</b></i>
</div>
<div class="open_source_protocol">
-11
View File
@@ -1,11 +0,0 @@
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/3/27
# @File Name: test_db.py
from app.db.db import SQLite
db = SQLite()