From c567336f59ebe5771b16da3530d16cd516c5ef7b Mon Sep 17 00:00:00 2001 From: MarkusJoe Date: Thu, 10 Feb 2022 13:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++++++---- app.py | 7 +++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d1ca35b..f0db496 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,18 @@ - 你可以在**注明来源版权信息**的情况下对源代码进行任意分发和修改以及衍生 ## 部署 -> 由于对`vercel`不熟悉, vercel的配置文件搞不明白所以暂时没有vercel的配置文件, 我也试了很多方法去部署但是要么是500要么是400 +### 已部署好的地址 +* https://requestcounters.herokuapp.com/get?name=MarkusJoe +* https://requestcounter.herokuapp.com/get?name=MarkusJoe +* 默认主题: `lewd` + + +### 部署到Heroku +1. `fork` 本项目到你的仓库 +2. 在[Heroku](https://www.heroku.com/) 注册账号 +3. 在[Dashboard](https://dashboard.heroku.com/apps) 新建App +4. 流程: 进入网址 -> 点击右上角`New` -> 点击 `Create new app` -> 输入App名称 -> `Create app` -> 选择`Github` (登陆完成后) -> 点击`Search` -> 选择你fork的项目并点击`Connect` -> 滑到末尾点击`Deploy branch`(如果你想在仓库更新时自动部署的话可以把`Enable Automatic Deploy`勾选) -> 等待完成 +5. App的地址就是 `App名称` + `.herokuapp.com` > 在部署之前你需要先安装`python3.10.x`以上的版本 ### 部署到本地服务器 @@ -94,6 +105,3 @@ riskofrain
neovb
ffsr
- - -* 仓库总共约`4.12Mb` `theme.db`占用了`4Mb` ... \ No newline at end of file diff --git a/app.py b/app.py index a333776..3de541d 100644 --- a/app.py +++ b/app.py @@ -23,7 +23,7 @@ app.config['JSON_SORT_KEYS'] = False # 设置JSON消息不根据字母顺序重 app.config['JSON_AS_ASCII'] = False # 设置JSON消息显示中文 -def build_page(name: str, length: int, theme: str) -> list[bool or Response] or list[bool or str] or bool: +def build_page(name: str, length: int, theme: str) -> list[bool | Response] | list[bool | str] | bool: """ 渲染最终的页面 :param theme: @@ -46,7 +46,7 @@ def build_page(name: str, length: int, theme: str) -> list[bool or Response] or @app.route('/get', methods=['GET', 'POST']) # 允许 GET 和 POST 方法 -def api_page() -> Response or str: +def api_page() -> Response | str: """ API 页面函数 :return: @@ -82,7 +82,7 @@ def api_page() -> Response or str: @app.route('/', methods=['GET', 'POST']) -def index(): +def index() -> Response: """ 索引页面 :return: @@ -92,7 +92,6 @@ def index(): if __name__ == '__main__': print('服务器已在 http://127.0.0.1:5000 运行') - # app.run() try: server = pywsgi.WSGIServer(('0.0.0.0', 5000), app) server.serve_forever()