This commit is contained in:
MarkusJoe
2022-02-10 13:35:32 +08:00
parent 625c2052aa
commit c567336f59
2 files changed
+15 -8

No files matched your search

+12 -4
View File
@@ -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`以上的版本 > 在部署之前你需要先安装`python3.10.x`以上的版本
### 部署到本地服务器 ### 部署到本地服务器
@@ -94,6 +105,3 @@ riskofrain<br>
neovb<br> neovb<br>
ffsr<br> ffsr<br>
</details> </details>
* 仓库总共约`4.12Mb` `theme.db`占用了`4Mb` ...
+3 -4
View File
@@ -23,7 +23,7 @@ app.config['JSON_SORT_KEYS'] = False # 设置JSON消息不根据字母顺序重
app.config['JSON_AS_ASCII'] = 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: :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 方法 @app.route('/get', methods=['GET', 'POST']) # 允许 GET 和 POST 方法
def api_page() -> Response or str: def api_page() -> Response | str:
""" """
API 页面函数 API 页面函数
:return: :return:
@@ -82,7 +82,7 @@ def api_page() -> Response or str:
@app.route('/', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST'])
def index(): def index() -> Response:
""" """
索引页面 索引页面
:return: :return:
@@ -92,7 +92,6 @@ def index():
if __name__ == '__main__': if __name__ == '__main__':
print('服务器已在 http://127.0.0.1:5000 运行') print('服务器已在 http://127.0.0.1:5000 运行')
# app.run()
try: try:
server = pywsgi.WSGIServer(('0.0.0.0', 5000), app) server = pywsgi.WSGIServer(('0.0.0.0', 5000), app)
server.serve_forever() server.serve_forever()