1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:33:48 +00:00
This commit is contained in:
孙永强
2025-08-06 18:12:41 +08:00
committed by r350178982
parent 2d2cace56b
commit 2943b1d67b
5 changed files with 10 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: "3.10" python-version: "3.12"
- name: apt install - name: apt install
run: | run: |
@@ -46,7 +46,6 @@ jobs:
- name: pip install - name: pip install
run: | run: |
pip install --upgrade pip
cd $GITHUB_WORKSPACE cd $GITHUB_WORKSPACE
pip install -r test-requirements.txt pip install -r test-requirements.txt
sudo rm -rf /usr/lib/python3/dist-packages/pytz/ sudo rm -rf /usr/lib/python3/dist-packages/pytz/

View File

@@ -2,6 +2,7 @@
from django.conf import settings from django.conf import settings
from django.core.cache import cache from django.core.cache import cache
from django.core.files.storage import default_storage from django.core.files.storage import default_storage
from django.utils.module_loading import import_string
from urllib.parse import quote from urllib.parse import quote
from seahub.base.accounts import User from seahub.base.accounts import User
@@ -112,7 +113,9 @@ def get_primary_avatar(user, size=AVATAR_DEFAULT_SIZE):
avatar.create_thumbnail(size) avatar.create_thumbnail(size)
return avatar return avatar
from django.utils.module_loading import import_string def get_storage_class(import_path=None):
return import_string(import_path or settings.STORAGES['default'])
def get_avatar_file_storage(): def get_avatar_file_storage():
"""Get avatar file storage, defaults to file system storage. """Get avatar file storage, defaults to file system storage.
""" """
@@ -126,4 +129,4 @@ def get_avatar_file_storage():
'data_column': 'data', 'data_column': 'data',
'size_column': 'size', 'size_column': 'size',
} }
return import_string(AVATAR_FILE_STORAGE or settings.STORAGES['default'])(options=dbs_options) return get_storage_class(AVATAR_FILE_STORAGE)(options=dbs_options)

View File

@@ -7,7 +7,8 @@ import os
import re import re
import copy import copy
FILE_SERVER_PORT = '8082' from seaserv import FILE_SERVER_PORT
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.pardir) PROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.pardir)
DEBUG = False DEBUG = False
@@ -108,7 +109,7 @@ STORAGES = {
"BACKEND": 'django.core.files.storage.FileSystemStorage' "BACKEND": 'django.core.files.storage.FileSystemStorage'
}, },
"staticfiles": { "staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", "BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
}, },
} }

View File

@@ -21,7 +21,6 @@ import seaserv
from seaserv import seafile_api, ccnet_api from seaserv import seafile_api, ccnet_api
from django.urls import reverse from django.urls import reverse
from django.core.mail import EmailMessage
from django.shortcuts import render from django.shortcuts import render
from django.template import loader from django.template import loader
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _

View File

@@ -28,7 +28,7 @@ SEAHUB_TESTSDIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('
SEAHUB_SRCDIR=$(dirname "${SEAHUB_TESTSDIR}") SEAHUB_SRCDIR=$(dirname "${SEAHUB_TESTSDIR}")
export SEAHUB_LOG_DIR='/tmp/logs' export SEAHUB_LOG_DIR='/tmp/logs'
export PYTHONPATH="/usr/local/lib/python3.10/site-packages:/usr/local/lib/python3.10/dist-packages:/usr/lib/python3.10/site-packages:/usr/lib/python3.10/dist-packages:${SEAHUB_SRCDIR}/thirdpart:${PYTHONPATH}" export PYTHONPATH="/usr/local/lib/python3.12/site-packages:/usr/local/lib/python3.12/dist-packages:/usr/lib/python3.12/site-packages:/usr/lib/python3.12/dist-packages:${SEAHUB_SRCDIR}/thirdpart:${PYTHONPATH}"
cd "$SEAHUB_SRCDIR" cd "$SEAHUB_SRCDIR"
set +x set +x