diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2e3032adbd..c71f6bc203 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.12" - name: apt install run: | @@ -46,7 +46,6 @@ jobs: - name: pip install run: | - pip install --upgrade pip cd $GITHUB_WORKSPACE pip install -r test-requirements.txt sudo rm -rf /usr/lib/python3/dist-packages/pytz/ diff --git a/seahub/avatar/util.py b/seahub/avatar/util.py index b642a2f406..e984dc1b28 100644 --- a/seahub/avatar/util.py +++ b/seahub/avatar/util.py @@ -2,6 +2,7 @@ from django.conf import settings from django.core.cache import cache from django.core.files.storage import default_storage +from django.utils.module_loading import import_string from urllib.parse import quote from seahub.base.accounts import User @@ -112,7 +113,9 @@ def get_primary_avatar(user, size=AVATAR_DEFAULT_SIZE): avatar.create_thumbnail(size) 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(): """Get avatar file storage, defaults to file system storage. """ @@ -126,4 +129,4 @@ def get_avatar_file_storage(): 'data_column': 'data', '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) diff --git a/seahub/settings.py b/seahub/settings.py index 347204957e..702dce796d 100644 --- a/seahub/settings.py +++ b/seahub/settings.py @@ -7,7 +7,8 @@ import os import re import copy -FILE_SERVER_PORT = '8082' +from seaserv import FILE_SERVER_PORT + PROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.pardir) DEBUG = False @@ -108,7 +109,7 @@ STORAGES = { "BACKEND": 'django.core.files.storage.FileSystemStorage' }, "staticfiles": { - "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + "BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage", }, } diff --git a/seahub/utils/__init__.py b/seahub/utils/__init__.py index 965550cfc3..82edb17a82 100644 --- a/seahub/utils/__init__.py +++ b/seahub/utils/__init__.py @@ -21,7 +21,6 @@ import seaserv from seaserv import seafile_api, ccnet_api from django.urls import reverse -from django.core.mail import EmailMessage from django.shortcuts import render from django.template import loader from django.utils.translation import gettext as _ diff --git a/tests/seahubtests.sh b/tests/seahubtests.sh index 3449db25ab..aebf3d0d3b 100755 --- a/tests/seahubtests.sh +++ b/tests/seahubtests.sh @@ -28,7 +28,7 @@ SEAHUB_TESTSDIR=$(python -c "import os; print(os.path.dirname(os.path.realpath(' SEAHUB_SRCDIR=$(dirname "${SEAHUB_TESTSDIR}") 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" set +x