File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,13 +37,15 @@ venv.bak/
3737# Application Data & Temporary Files
3838grades_raw.json
3939shared_grades /
40+ .flask_session /
4041* .json
4142! requirements.txt
4243! .env.example
4344! package.json
4445! manifest.json
4546* .md
4647! README.md
48+ 0_build_and_deploy.txt
4749# Exclude specific JSONs but allow config templates if any
4850
4951# Large Files
Original file line number Diff line number Diff line change @@ -33,11 +33,9 @@ def create_app():
3333
3434 flask_env = os .environ .get ('FLASK_ENV' , '' ).lower ()
3535 app_env = os .environ .get ('APP_ENV' , '' ).lower ()
36- is_dev = flask_env in ('development' , 'testing' ) or app_env in ('development' , 'testing' )
3736
3837 try :
39- if is_dev :
40- redis_client .ping ()
38+ redis_client .ping ()
4139 app .config ['REDIS_CLIENT' ] = redis_client
4240 app .config ['SESSION_TYPE' ] = 'redis'
4341 app .config ['SESSION_REDIS' ] = redis_client
@@ -47,6 +45,9 @@ def create_app():
4745 Session (app )
4846 except redis .exceptions .ConnectionError :
4947 app .config ['REDIS_CLIENT' ] = None
48+ # 退回不使用 Redis session
49+ app .config ['SESSION_TYPE' ] = 'null'
50+ Session (app )
5051 print ("WARNING: Redis not available. Using default cookie session for development." )
5152
5253 app .config ['TURNSTILE_SITE_KEY' ] = os .environ .get ('TURNSTILE_SITE_KEY' , '' )
Original file line number Diff line number Diff line change 11services :
22 app :
3- image : ghcr.io/${GHCR_IMAGE:-alvin000009238/school_grades}:latest
3+ build : .
4+ image : ghcr.io/${GHCR_IMAGE:-alvin000009238/grades}:latest
45 environment :
56 - PYTHONUNBUFFERED=1
67 - SECRET_KEY=${SECRET_KEY}
78 - CORS_ORIGINS=${CORS_ORIGINS}
8- - REDIS_URL=${REDIS_URL:- redis://redis:6379/0}
9+ - REDIS_URL=redis://redis:6379/0
910 - TURNSTILE_SITE_KEY=${TURNSTILE_SITE_KEY}
1011 - TURNSTILE_SECRET_KEY=${TURNSTILE_SECRET_KEY}
1112 - TZ=Asia/Taipei
13+ ports :
14+ - " 5000:5000"
1215
1316 depends_on :
1417 - redis
You can’t perform that action at this time.
0 commit comments