Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update markdowns #20

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ ENV/
out
gen
/logs/log.txt
/docs/
/file/tmp/*

# VSCode project files
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

## Version 1.1.2

https://github.com/moeflow-com/moeflow-backend/releases/tag/v1.1.2

- upgrade python and deps
- ruff / CI
- move DB migration to manage.py

### Version.1.0.1

1. 修改部分没做本地化的位置(例如:首页、邮件),方便修改网站名称、标题、域名等信息。
2. 调整 config.py 中的配置格式,部分配置有默认值可选。
3. 调整阿里云 OSS 相关域名输出格式,私有读写模式下缩略图、下载等位置正常显示
4. 调整输出的翻译文本格式为 `utf-8`
5. 调整创建项目、创建团队时的部分参数,减少前端需配置的默认值。
6. 修改后端首页模版、增加 404 跳转到首页的代码。方便将前后端项目进行合并。(相关操作说明请参考前端帮助文件中对应段落!)


### Version 1.0.0

萌翻前后端开源的首个版本

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 kozzzx
Copyright (c) 2022-present kozzzx

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
53 changes: 7 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,14 @@
# 萌翻[MoeFlow]后端项目
# moeflow-backend

[![codecov](https://codecov.io/gh/moeflow-com/moeflow-backend/graph/badge.svg?token=LQJBLB495F)](https://codecov.io/gh/moeflow-com/moeflow-backend)
API + storage server for [moeflow](https://github.com/moeflow-com)

由于此版本调整了部分 API 接口, **请配合萌翻前端 Version.1.0.1 版本使用!** 直接使用旧版可能在修改(创建)团队和项目时报错。
[![codecov](https://codecov.io/gh/moeflow-com/moeflow-backend/graph/badge.svg?token=LQJBLB495F)](https://codecov.io/gh/moeflow-com/moeflow-backend) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=moeflow-com_moeflow-backend&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=moeflow-com_moeflow-backend)

此版本需配置 **阿里云 OSS** 作为文件存储。如果需要使用其他文件存储方式,可以选择使用以下的分支版本:
## How to deploy

- **本地硬盘存储** [`scanlation/moetran-local-backend`](https://github.com/scanlation/moetran-local-backend)
Please refer to instruction in https://github.com/moeflow-com/moeflow-deploy

## 安装步骤
## How to develop

1. 安装 Python 3.10 版本
2. 依赖环境 MangoDB、Erlang、RabbitMQ
3. `pip install -r requirements.txt` (这一步如果 Windows 有报错,请在环境变量里面加 `PYTHONUTF8=1` )
4. 以 `/config.py` 为模板创建 `/configs/dev.py` 用于开发(此目录已被 git ignore)
5. 开发时,请直接在 `/configs/dev.py` 文件里面修改必填的配置
6. 运行前注意配置环境变量 `CONFIG_PATH=../configs/dev.py`
7. 运行主进程: `python manage.py run`
8. 在 `DEBUG` 开启的情况下,注册等验证码信息,直接看命令行输出的日志信息。
9. _(可选)_ 导入、导出等功能需要依赖两个 celery worker 进程,调试时可按另附的步骤启动。

## 配置 Celery

1. 如果使用 Windows 跑 Celery Worker,需要先安装 `eventlet` 并修改参数,否则会提示: `not enough values to unpack (expected 3, got 0)`
2. _(可选)_ Windows 安装 `eventlet` 请执行: `pip install eventlet`
3. 两个 worker 需要启动两个命令行(**这里的方案使用 Windows 的 Powershell 举例**),运行前需配置环境变量:`CONFIG_PATH=../configs/dev.py`
4. 启动主要 Celery Worker (发送邮件、分析术语),请执行:`celery -A app.celery worker -n default -P eventlet --loglevel=info`
5. 启动输出用 Celery Worker (导入项目、生成缩略图、导出翻译、导出项目),请执行:`celery -A app.celery worker -Q output -n output -P eventlet --loglevel=info`
6. 非 Windows 环境如果有报错,请去掉命令中的 `-P eventlet` 一段。

## 如何测试

1. 配置测试 `test.py`
1. DEBUG = True 和 TESTING = True
2. DB_URI 协议名使用 `mongomock://` 并将数据库名以 `_test` 结尾
3. 将 `CONFIRM_EMAIL_WAIT_SECONDS` `RESET_EMAIL_WAIT_SECONDS` `RESET_PASSWORD_WAIT_SECONDS` 设置为 `1`,以免过多等待
2. 执行 `export CONFIG_PATH=/path/to/configs/test.py && pytest -n auto` 开始并行测试

## 版本修改内容一览

### Version 1.0.0

萌翻前后端开源的首个版本

### Version.1.0.1

1. 修改部分没做本地化的位置(例如:首页、邮件),方便修改网站名称、标题、域名等信息。
2. 调整 config.py 中的配置格式,部分配置有默认值可选。
3. 调整阿里云 OSS 相关域名输出格式,私有读写模式下缩略图、下载等位置正常显示
4. 调整输出的翻译文本格式为 `utf-8`
5. 调整创建项目、创建团队时的部分参数,减少前端需配置的默认值。
6. 修改后端首页模版、增加 404 跳转到首页的代码。方便将前后端项目进行合并。(相关操作说明请参考前端帮助文件中对应段落!)
## model
36 changes: 36 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 萌翻[MoeFlow]后端项目

由于此版本调整了部分 API 接口, **请配合萌翻前端 Version.1.0.1 版本使用!** 直接使用旧版可能在修改(创建)团队和项目时报错。

此版本需配置 **阿里云 OSS** 作为文件存储。如果需要使用其他文件存储方式,可以选择使用以下的分支版本:

- **本地硬盘存储** [`scanlation/moetran-local-backend`](https://github.com/scanlation/moetran-local-backend)

## 安装步骤

1. 安装 Python 3.10 版本
2. 依赖环境 MangoDB、Erlang、RabbitMQ
3. `pip install -r requirements.txt` (这一步如果 Windows 有报错,请在环境变量里面加 `PYTHONUTF8=1` )
4. 以 `/config.py` 为模板创建 `/configs/dev.py` 用于开发(此目录已被 git ignore)
5. 开发时,请直接在 `/configs/dev.py` 文件里面修改必填的配置
6. 运行前注意配置环境变量 `CONFIG_PATH=../configs/dev.py`
7. 运行主进程: `python manage.py run`
8. 在 `DEBUG` 开启的情况下,注册等验证码信息,直接看命令行输出的日志信息。
9. _(可选)_ 导入、导出等功能需要依赖两个 celery worker 进程,调试时可按另附的步骤启动。

## 配置 Celery

1. 如果使用 Windows 跑 Celery Worker,需要先安装 `eventlet` 并修改参数,否则会提示: `not enough values to unpack (expected 3, got 0)`
2. _(可选)_ Windows 安装 `eventlet` 请执行: `pip install eventlet`
3. 两个 worker 需要启动两个命令行(**这里的方案使用 Windows 的 Powershell 举例**),运行前需配置环境变量:`CONFIG_PATH=../configs/dev.py`
4. 启动主要 Celery Worker (发送邮件、分析术语),请执行:`celery -A app.celery worker -n default -P eventlet --loglevel=info`
5. 启动输出用 Celery Worker (导入项目、生成缩略图、导出翻译、导出项目),请执行:`celery -A app.celery worker -Q output -n output -P eventlet --loglevel=info`
6. 非 Windows 环境如果有报错,请去掉命令中的 `-P eventlet` 一段。

## 如何测试

1. 配置测试 `test.py`
1. DEBUG = True 和 TESTING = True
2. DB_URI 协议名使用 `mongomock://` 并将数据库名以 `_test` 结尾
3. 将 `CONFIRM_EMAIL_WAIT_SECONDS` `RESET_EMAIL_WAIT_SECONDS` `RESET_PASSWORD_WAIT_SECONDS` 设置为 `1`,以免过多等待
2. 执行 `export CONFIG_PATH=/path/to/configs/test.py && pytest -n auto` 开始并行测试
83 changes: 83 additions & 0 deletions docs/models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# models

Persistent models in MongoDB.

## Core

### User



### Team

`Team`

### Projects

`Project` `ProjectSet` `Files`

### Translations

`Source` `Target`

## etc

- `Application`
- `VCode`

<!--
git grep -w class -- app/models/

------- global

app/models/user.py:class User(Document):

app/models/file.py:class Filename:
app/models/file.py:class File(Document):
app/models/file.py:class FileTargetCache(Document):
app/models/file.py:class Source(Document):
app/models/file.py:class Translation(Document):
app/models/file.py:class Tip(Document):


------ Team

app/models/team.py:class TeamPermission(PermissionMixin):
app/models/team.py:class TeamRole(RoleMixin, Document):
app/models/team.py:class Team(GroupMixin, Document):
app/models/team.py:class TeamUserRelation(RelationMixin, Document):

------ Project

app/models/project.py:class ProjectSet(Document):
app/models/project.py:class ProjectRole(RoleMixin, Document):
app/models/project.py:class ProjectUserRelation(RelationMixin, Document):

------ inside Project

app/models/project.py:class Project(GroupMixin, Document):
app/models/language.py:class Language(Document):
app/models/message.py:class Message(Document):
app/models/output.py:class Output(Document):

------

app/models/project.py:class ProjectAllowApplyType(AllowApplyType):
app/models/project.py:class ProjectPermission(PermissionMixin):
app/models/target.py:class Target(Document):

app/models/term.py:class TermBank(Document):
app/models/term.py:class TermGroup(Document):
app/models/term.py:class Term(Document):

app/models/invitation.py:class InvitationStatus:
app/models/invitation.py:class Invitation(Document):

app/models/application.py:class ApplicationStatus:
app/models/application.py:class Application(Document):

app/models/v_code.py:class VCode(Document):
app/models/v_code.py:class Captcha(VCode):

app/models/site_setting.py:class SiteSetting(Document):
-->
3 changes: 3 additions & 0 deletions docs/user_stories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# user stories

TODO