Fix static resources issue

This commit is contained in:
2026-03-21 22:49:18 +11:00
parent a8ff146e95
commit 1ffdb5d2ba
3 changed files with 3 additions and 16 deletions
+1
View File
@@ -136,6 +136,7 @@ COPY --chown=appuser:appuser links/ ./links/
COPY --chown=appuser:appuser netscan/ ./netscan/
COPY --chown=appuser:appuser new_theme/ ./new_theme/
COPY --chown=appuser:appuser templates/ ./templates/
COPY --chown=appuser:appuser static/ ./static/
COPY --chown=appuser:appuser qdrant_sync.py ./
# Final cleanup
+1 -15
View File
@@ -25,21 +25,6 @@ INSTALLED_APPS = [
ROOT_URLCONF = 'core.urls'
# Why WhiteNoise failed: WhiteNoiseMiddleware was at the bottom of MIDDLEWARE (position 8). WhiteNoise requires being right after SecurityMiddleware (position 2) so
# it can intercept /static/* requests before other middleware processes them. When it was last, the requests were falling through to Django URL routing, which
# returned HTML 404 pages.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'core.middleware.CustomLocaleMiddleware', # 替换原来的 LocaleMiddleware
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
@@ -177,6 +162,7 @@ LOCALE_INDEPENDENT_PATHS = [
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'core.middleware.CustomLocaleMiddleware', # 使用自定义中间件
'django.middleware.common.CommonMiddleware',
+1 -1
View File
@@ -103,7 +103,7 @@ spec:
initContainers:
- name: links-init
image: "ghcr.io/wahyd4/links:main"
command: ["sh", "-c", "uv run manage.py migrate && uv run manage.py collectstatic --noinput && uv run manage.py rebuild_search_index"]
command: ["sh", "-c", "uv run manage.py migrate && uv run manage.py rebuild_search_index"]
volumeMounts:
- name: data
mountPath: /app/data