diff --git a/.cruft.json b/.cruft.json index d3c3487..f7d42c0 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/OVINC-CN/DevTemplateDjango.git", - "commit": "ef125c550e0dc7f52fff1a3e4d1b4a73cebd8e32", + "commit": "77faa1ff4b8231ddbe45ee359b592442a9c4cda1", "checkout": "main", "context": { "cookiecutter": { diff --git a/.env.tpl b/.env.tpl deleted file mode 100644 index a16fd73..0000000 --- a/.env.tpl +++ /dev/null @@ -1,26 +0,0 @@ -# DEBUG -DEBUG=False -# APP -APP_CODE= -APP_SECRET= -# HOST -BACKEND_HOST= -FRONTEND_URL= -# DB -DB_NAME= -DB_USER= -DB_PASSWORD= -DB_HOST= -DB_PORT= -# Redis -REDIS_HOST= -REDIS_PORT= -REDIS_PASSWORD= -REDIS_DB= -# QCloud -QCLOUD_SECRET_ID= -QCLOUD_SECRET_KEY= -# COS -COS_REGION= -COS_BUCKET= -COS_DOMAIN= diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 5d40982..1507174 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -26,4 +26,4 @@ jobs: pip install -r requirements.txt - name: Analysing the code with pylint run: | - pylint --disable=C0114,W0613,C0115,W1113,W0223,C0116,R0901,R0903,C0209 --max-line-length=120 $(git ls-files '*.py') + make pylint diff --git a/.gitignore b/.gitignore index 80a1a12..01dbe79 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ env .env +# Trasnlation +*.mo + # Python *.pyc *.db diff --git a/Dockerfile b/Dockerfile index e38d3b1..8ee25cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,16 @@ -FROM python:3.10 -RUN mkdir -p /usr/src/app/celery-logs /usr/src/app/logs /usr/src/app/daphne-logs -COPY . /usr/src/app +FROM python:3.10.15-slim + WORKDIR /usr/src/app + +COPY requirements.txt /usr/src/app/ RUN pip3 install -U pip && pip3 install -r requirements.txt + +COPY . /usr/src/app + +RUN export https_proxy=http://10.1.0.163:6152 && export http_proxy=http://10.1.0.163:6152 && export all_proxy=socks5://10.1.0.163:6153 && apt-get update && apt-get install -y gettext + +RUN cp env.example .env \ + && python3 manage.py compilemessages -l zh_Hans \ + && rm -rf .env + +RUN mkdir -p /usr/src/app/celery-logs /usr/src/app/logs /usr/src/app/daphne-logs diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..89c561b --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +pylint: + scripts/pylint.sh + +pre-commit: + scripts/pre-commit.sh + +lint: pre-commit pylint diff --git a/env.example b/env.example new file mode 100644 index 0000000..7be0426 --- /dev/null +++ b/env.example @@ -0,0 +1,16 @@ +APP_CODE=union-api +APP_SECRET=union-api +BACKEND_URL=https://dev-api.example.com +BACKEND_HOST=dev-api.example.com +FRONTEND_URL=https://dev.example.com +DB_NAME=union-api +DB_USER=union-api +DB_PASSWORD= +DB_HOST=127.0.0.1 +DB_PORT=3306 +REDIS_HOST=127.0.0.1 +REDIS_PORT=6379 +REDIS_PASSWORD= +REDIS_DB=0 +OVINC_API_DOMAIN=https://api.example.com +OVINC_WEB_URL=https://www.example.com diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh new file mode 100755 index 0000000..07c0956 --- /dev/null +++ b/scripts/pre-commit.sh @@ -0,0 +1,2 @@ +#!/bin/sh +pre-commit run -a diff --git a/scripts/pylint.sh b/scripts/pylint.sh new file mode 100755 index 0000000..db38b83 --- /dev/null +++ b/scripts/pylint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +pylint --disable=C0114,W0613,C0115,W1113,W0223,C0116,R0901,R0903,C0209 --max-line-length=120 $(git ls-files '*.py')