新增“数据编辑”

This commit is contained in:
2025-11-13 16:52:23 +08:00
parent 1bbd777565
commit d37d60b896
10 changed files with 210 additions and 39 deletions

View File

@@ -11,6 +11,8 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
"""
from pathlib import Path
import os
from elastic.indexes import INDEX_NAME
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -120,6 +122,10 @@ USE_TZ = True
STATIC_URL = 'static/'
# Media files (uploaded images)
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
# Security settings for cookies and headers (dev-friendly defaults)
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax'
@@ -144,7 +150,10 @@ ELASTICSEARCH_DSL = {
# Elasticsearch index settings
ELASTICSEARCH_INDEX_NAMES = {
'elastic.documents.AchievementDocument': 'wordsearch266666',
'elastic.documents.UserDocument': 'users',
'elastic.documents.NewsDocument': 'elastic_news',
'elastic.documents.AchievementDocument': INDEX_NAME,
'elastic.documents.UserDocument': INDEX_NAME,
}
# AI Studio/OpenAI client settings
AISTUDIO_API_KEY = os.environ.get('AISTUDIO_API_KEY', '')
OPENAI_BASE_URL = os.environ.get('OPENAI_BASE_URL', 'https://aistudio.baidu.com/llm/lmapi/v3')

View File

@@ -16,6 +16,8 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from main.views import home as main_home
urlpatterns = [
@@ -25,3 +27,6 @@ urlpatterns = [
path('elastic/', include('elastic.urls', namespace='elastic')),
path('', main_home, name='root_home'),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)