add deta.sh support

This commit is contained in:
hillerliao
2022-05-08 10:56:47 +08:00
parent 3324f8f790
commit 52ca4324f4
11 changed files with 283 additions and 360 deletions

View File

@@ -8,7 +8,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
**其实用Python写爬虫要比JS更方便:p**
DEMO地址https://pyrsshub.herokuapp.com
DEMO地址https://rsshub.deta.dev
## RSS过滤
@@ -20,7 +20,7 @@ DEMO地址https://pyrsshub.herokuapp.com
- exclude_description: 排除描述
- limit: 限制条数
## 贡献RSS方法
## 贡献 RSS 方法
1. fork这份仓库
2. 在spiders文件夹下创建新的爬虫目录和脚本编写爬虫参考我的[爬虫教程](https://alphardex.github.io/2018/12/15/%E7%BD%91%E7%BB%9C%E7%88%AC%E8%99%AB%E7%B2%BE%E8%A6%81/)
@@ -30,7 +30,7 @@ DEMO地址https://pyrsshub.herokuapp.com
## 部署
### 搭建
### 本地测试
首先确保安装了[pipenv](https://github.com/pypa/pipenv)
@@ -39,22 +39,29 @@ git clone https://github.com/alphardex/RSSHub-python
cd RSSHub-python
pipenv install --dev
pipenv shell
```
### 运行
``` bash
flask run
```
### 部署到Heroku
### 生产环境
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/hillerliao/RSSHub-python)
``` bash
gunicorn main:app -b 0.0.0.0:5000
```
记得在环境变量中把FLASK_CONFIG设为production
### 部署到 deta.dev
[![Deploy](https://button.deta.dev/1/svg)](https://go.deta.dev/deploy?repo=https://github.com/hillerliao/rsshub-python)
安装 [Deta CLI](https://docs.deta.sh/docs/cli/install/)
在终端运行`deta login`
在项目根目录运行`deta new --python pyrsshub`
将 `pyrsshub` 目录下的 `.deta` 文件夹移到根目录;
运行`deta deploy`
获取网址 `https://<micro_name>.deta.dev/`
更新`deta update`
### Docker 部署
制作镜像文件 `docker image build -t rsshub_python .`
制作镜像文件 `docker build -t pyrsshub:latest .`
创建docker容器 `docker run -dit -p 6666:6666 --name rsshub rsshub_python`
创建docker容器 `docker run -dit --name pyrsshub -p 8080:80 pyrsshub:latest`