File tree Expand file tree Collapse file tree
DjangoUserService/DjangoUserService Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 - uses : astral-sh/setup-uv@v5
1919 with :
2020 python-version : " 3.12"
21- - name : Install dependencies
22- run : uv sync --group dev
2321 - name : Run ruff
24- run : uv run ruff check .
22+ run : uvx ruff check .
2523
2624 frontend-build :
2725 name : Frontend Build
@@ -53,12 +51,18 @@ jobs:
5351 with :
5452 python-version : " 3.12"
5553 - name : Install dependencies
56- run : uv sync
54+ run : uv sync --no-build-isolation
5755 - name : Django check
5856 run : uv run python manage.py check --deploy
5957 env :
6058 DJANGO_SETTINGS_MODULE : DjangoUserService.settings
6159 JWT_SECRET_KEY : ci-test-key
6260 DB_ENGINE : django.db.backends.sqlite3
63- DB_NAME : db.sqlite3
64- CELERY_TASK_ALWAYS_EAGER : " True"
61+ DB_NAME : ci_db.sqlite3
62+ DB_USER : " "
63+ DB_PASSWORD : " "
64+ DB_HOST : " "
65+ DB_PORT : " "
66+ REDIS_CACHE_URL : redis://localhost:6379/1
67+ CELERY_BROKER_URL : redis://localhost:6379/0
68+ CELERY_RESULT_BACKEND : redis://localhost:6379/0
Original file line number Diff line number Diff line change 100100
101101DATABASES = {
102102 'default' : {
103- 'ENGINE' : ' django.db.backends.mysql' ,
103+ 'ENGINE' : os . getenv ( 'DB_ENGINE' , ' django.db.backends.mysql') ,
104104 'NAME' : os .getenv ('DB_NAME' ),
105105 'USER' : os .getenv ('DB_USER' ),
106106 'PASSWORD' : os .getenv ('DB_PASSWORD' ),
107107 'HOST' : os .getenv ('DB_HOST' ),
108108 'PORT' : os .getenv ('DB_PORT' ),
109- 'OPTIONS' : {
110- 'charset' : 'utf8mb4' ,
111- 'use_unicode' : True ,
112- 'init_command' : 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci' ,
113- },
114109 }
115110}
116111
112+ # MySQL 特有配置(非 SQLite 时使用)
113+ if DATABASES ['default' ]['ENGINE' ] != 'django.db.backends.sqlite3' :
114+ DATABASES ['default' ]['OPTIONS' ] = {
115+ 'charset' : 'utf8mb4' ,
116+ 'use_unicode' : True ,
117+ 'init_command' : 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci' ,
118+ }
119+
117120# Celery 配置
118121CELERY_BROKER_URL = os .getenv ('CELERY_BROKER_URL' )
119122CELERY_RESULT_BACKEND = os .getenv ('CELERY_RESULT_BACKEND' )
You can’t perform that action at this time.
0 commit comments