Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
data_report
/
daw
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 910a19bf
authored
Jul 14, 2026
by
江名洋
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 设置容器及应用时区为东八区
1 parent
50ed92dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletions
docker-compose.yml
docker/Dockerfile
main.py
docker-compose.yml
View file @
910a19b
...
@@ -6,9 +6,12 @@ services:
...
@@ -6,9 +6,12 @@ services:
container_name
:
daw
container_name
:
daw
ports
:
ports
:
-
"
9500:9500"
-
"
9500:9500"
environment
:
-
TZ=Asia/Shanghai
volumes
:
volumes
:
-
./app/templates:/app/app/templates
-
./app/templates:/app/app/templates
-
./temp_uploads:/app/temp_uploads
-
./temp_uploads:/app/temp_uploads
-
/etc/localtime:/etc/localtime:ro
env_file
:
env_file
:
-
.env
-
.env
restart
:
unless-stopped
restart
:
unless-stopped
docker/Dockerfile
View file @
910a19b
FROM
python:3.11-slim
FROM
python:3.11-slim
# 设置系统时区为东八区
ENV
TZ=Asia/Shanghai
RUN
apt-get update
&&
apt-get install -y --no-install-recommends tzdata
&&
\
ln -snf /usr/share/zoneinfo/
$TZ
/etc/localtime
&&
echo
$TZ
> /etc/timezone
&&
\
rm -rf /var/lib/apt/lists/
*
# PyPI 镜像加速(清华源)
# PyPI 镜像加速(清华源)
ENV
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
ENV
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
...
...
main.py
View file @
910a19b
...
@@ -5,8 +5,17 @@
...
@@ -5,8 +5,17 @@
注意: 不要删除这个注释。
注意: 不要删除这个注释。
"""
"""
import
uvicorn
import
os
import
os
import
time
# 强制设置时区为东八区(Docker/服务器兜底)
os
.
environ
.
setdefault
(
"TZ"
,
"Asia/Shanghai"
)
try
:
time
.
tzset
()
except
AttributeError
:
pass
# Windows 不支持 tzset,Docker Linux 环境生效
import
uvicorn
import
asyncio
import
asyncio
from
fastapi
import
Depends
,
FastAPI
,
HTTPException
,
Request
from
fastapi
import
Depends
,
FastAPI
,
HTTPException
,
Request
from
fastapi.responses
import
RedirectResponse
from
fastapi.responses
import
RedirectResponse
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment