Skip to content

Commit

Permalink
Support deployment to Huggingface Space
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjiurine committed Dec 9, 2023
1 parent 7a80daa commit b6e5a97
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A **simple**, **safe**, **free** comment system.

### 简单

* 免费搭建(使用云开发 / Vercel / 私有部署评论后台)
* 免费搭建(使用云开发 / Vercel / 私有部署评论后台 / Huggingface Space
* 简单部署(支持云开发 / Vercel 一键部署)

### 易用
Expand Down
30 changes: 26 additions & 4 deletions src/server/huggingface-space/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
---
title: Twikoo Huggingface Space
emoji: 😻
colorFrom: red
colorTo: green
emoji: 📚
colorFrom: yellow
colorTo: indigo
sdk: docker
pinned: false
app_port: 8080
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# Twikoo Huggingface Space部署

## 安装

1.在Huggingface创建一个Space,可视化必须为Public
2.在Space中添加`MONGODB_URI`环境变量
3.clone Huggingface Space仓库
4.clone主仓库,进入该目录,将该目录下的所有文件(不包括.git文件夹)复制到Huggingface Space仓库中
5.push Huggingface Space仓库
6.在Huggingface Space页面中右键,选择查看框架源代码,获取真实部署url
7.前端url配置方式与其他部署方式相同(url末尾不要带有任何字符串)
8.开始享受Twikoo!

## 环境变量

| 名称 | 描述 | 默认值 |
| ---- | ---- | ---- |
| `MONGODB_URI` | MongoDB 数据库连接字符串 *必须 | `null` |
| `TWIKOO_THROTTLE` | IP 请求限流,当同一 IP 短时间内请求次数超过阈值将对该 IP 返回错误 | `250` |
| `TWIKOO_LOG_LEVEL` | 日志级别,支持 `verbose` / `info` / `warn` / `error` | `info` |
| `TWIKOO_IP_HEADERS` | 在一些特殊情况下使用,如使用了`CloudFlare CDN` 它会将请求 IP 写到请求头的 `cf-connecting-ip` 字段上,为了能够正确的获取请求 IP 你可以写成 `['headers.cf-connecting-ip']` | `[]` |

在构建前请确保已经添加`MONGODB_URI`环境变量,否则可能出现不可预估的错误

0 comments on commit b6e5a97

Please sign in to comment.