伟大的更新:优化静态资源路径,加入Nginx配置,安全至上!
1
.gitignore
vendored
@ -13,3 +13,4 @@ docs/.cache/
|
|||||||
.qodo
|
.qodo
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
#pr_agent/
|
#pr_agent/
|
||||||
|
static/admin/
|
||||||
14
README.MD
@ -86,18 +86,18 @@ python manage.py runserver
|
|||||||
|
|
||||||
## PR管理系统配置说明
|
## PR管理系统配置说明
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
所有配置均通过 Django admin 后台管理,主要包括:
|
所有配置均通过 Django admin 后台管理,主要包括:
|
||||||
- **AI 服务器**:配置 AI 服务接入信息。
|
- **AI 服务器**:配置 AI 服务接入信息。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- **Git 服务器**:配置与各 Git 服务的连接及 webhook 信息。
|
- **Git 服务器**:配置与各 Git 服务的连接及 webhook 信息。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- **指令设置**:配置在 webhook 触发时需要执行的各项指令(例如代码审核、描述与改进)。
|
- **指令设置**:配置在 webhook 触发时需要执行的各项指令(例如代码审核、描述与改进)。
|
||||||
|
|
||||||
@ -107,15 +107,15 @@ python manage.py runserver
|
|||||||
|
|
||||||
- **用户AccessToken**: 配置Gitlab用户的AccessToken,用于获取用户信息。
|
- **用户AccessToken**: 配置Gitlab用户的AccessToken,用于获取用户信息。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- **项目Secret**: 配置Gitlab项目的Secret,用于验证请求的合法性。
|
- **项目Secret**: 配置Gitlab项目的Secret,用于验证请求的合法性。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- **Webhook配置**: 配置Gitlab项目的Webhook,用于处理Gitlab的推送事件。
|
- **Webhook配置**: 配置Gitlab项目的Webhook,用于处理Gitlab的推送事件。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## 默认账号及 Git 服务器支持
|
## 默认账号及 Git 服务器支持
|
||||||
|
|||||||
@ -1,4 +1,17 @@
|
|||||||
services:
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
container_name: nginx
|
||||||
|
ports:
|
||||||
|
- "10008:80"
|
||||||
|
volumes:
|
||||||
|
- ./static/nginx:/etc/nginx/conf.d
|
||||||
|
- ./static/:/app/static
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50M"
|
||||||
|
max-file: "1"
|
||||||
# admin服务
|
# admin服务
|
||||||
backend:
|
backend:
|
||||||
image: pr_manager:latest
|
image: pr_manager:latest
|
||||||
|
|||||||
@ -27,7 +27,7 @@ sys.path.insert(1, os.path.join(BASE_DIR, "apps/utils"))
|
|||||||
SECRET_KEY = "django-insecure-$r6lfcq8rev&&=chw259o$0o7t-!!%clc2ahs3xg$^z+gkms76"
|
SECRET_KEY = "django-insecure-$r6lfcq8rev&&=chw259o$0o7t-!!%clc2ahs3xg$^z+gkms76"
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = ["*"]
|
ALLOWED_HOSTS = ["*"]
|
||||||
|
|
||||||
@ -128,11 +128,17 @@ USE_L10N = True
|
|||||||
|
|
||||||
USE_TZ = False
|
USE_TZ = False
|
||||||
|
|
||||||
|
# 全局时间格式化
|
||||||
|
DATETIME_FORMAT = "Y-m-d H:i:sO"
|
||||||
|
date_format = 'Y-m-d'
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = "static/"
|
STATIC_URL = "/static/"
|
||||||
|
|
||||||
|
# 生产环境目录
|
||||||
|
STATIC_ROOT = BASE_DIR / "static"
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
22
static/nginx/pr.conf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
client_max_body_size 512M;
|
||||||
|
keepalive_timeout 1800s;
|
||||||
|
sendfile on;
|
||||||
|
chunked_transfer_encoding on;
|
||||||
|
|
||||||
|
|
||||||
|
location /static {
|
||||||
|
alias /app/static/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header Access-Control-Allow-Origin *;
|
||||||
|
proxy_set_header Access-Control-Allow-Methods *;
|
||||||
|
proxy_set_header Access-Control-Allow-Headers *;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_pass http://backend:18000;
|
||||||
|
}
|
||||||
|
}
|
||||||