diff --git a/aleksis/core/settings.py b/aleksis/core/settings.py index b0967c17c99df7ef90e9d2732806fabb8f90157d..9a4be3627bccbcb163465cffe1d3e5f49ff76a18 100644 --- a/aleksis/core/settings.py +++ b/aleksis/core/settings.py @@ -70,7 +70,7 @@ UWSGI = { "module": "aleksis.core.wsgi", } UWSGI_SERVE_STATIC = True -UWSGI_SERVE_MEDIA = True +UWSGI_SERVE_MEDIA = False ALLOWED_HOSTS = _settings.get("http.allowed_hosts", []) @@ -831,7 +831,8 @@ if _settings.get("storage.type", "").lower() == "s3": AWS_S3_SIGNATURE_VERSION = _settings.get("storage.s3.signature_version", None) AWS_S3_FILE_OVERWRITE = _settings.get("storage.s3.file_overwrite", False) else: - DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage" + DEFAULT_FILE_STORAGE = "titofisto.TitofistoStorage" + TITOFISTO_TIMEOUT = 10 * 60 SASS_PROCESSOR_STORAGE = DEFAULT_FILE_STORAGE diff --git a/aleksis/core/urls.py b/aleksis/core/urls.py index 9ccf5aebff5c5fd36947626584cd6287dad5a3c7..57aabbd8ca929f938426335acafde12346b1c973 100644 --- a/aleksis/core/urls.py +++ b/aleksis/core/urls.py @@ -19,6 +19,7 @@ from . import views urlpatterns = [ path("", include("django_prometheus.urls")), path("", include("pwa.urls"), name="pwa"), + path(settings.MEDIA_URL.removeprefix("/"), include("titofisto.urls")), path("about/", views.about, name="about_aleksis"), path("admin/", admin.site.urls), path("admin/uwsgi/", include("django_uwsgi.urls")), diff --git a/poetry.lock b/poetry.lock index 262440f8988dcd1a6d03b46dfca5e429ba14b5e0..b9845f4e216c7ffd5c07d0e58f6c3889ab25a05c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -81,9 +81,6 @@ category = "main" optional = false python-versions = ">=3.6" -[package.dependencies] -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} - [package.extras] tests = ["pytest", "pytest-asyncio", "mypy (>=0.800)"] @@ -1128,6 +1125,17 @@ pytz = "*" [package.extras] rest_framework = ["djangorestframework (>=3.0.0)"] +[[package]] +name = "django-titofisto" +version = "0.1.0" +description = "Django Time-Token File Storage" +category = "main" +optional = false +python-versions = ">=3.9,<4.0" + +[package.dependencies] +Django = ">2.2,<4.0" + [[package]] name = "django-two-factor-auth" version = "1.13.1" @@ -1262,7 +1270,6 @@ optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [package.dependencies] -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} mccabe = ">=0.6.0,<0.7.0" pycodestyle = ">=2.7.0,<2.8.0" pyflakes = ">=2.3.0,<2.4.0" @@ -1424,7 +1431,6 @@ python-versions = ">=3.5" [package.dependencies] gitdb = ">=4.0.1,<5" -typing-extensions = {version = ">=3.7.4.0", markers = "python_version < \"3.8\""} [[package]] name = "html2text" @@ -1450,22 +1456,6 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -[[package]] -name = "importlib-metadata" -version = "4.0.1" -description = "Read metadata from Python packages" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] - [[package]] name = "iniconfig" version = "1.1.1" @@ -1585,7 +1575,6 @@ python-versions = ">=3.6" [package.dependencies] amqp = ">=5.0.0,<6.0.0" -importlib-metadata = {version = ">=0.18", markers = "python_version < \"3.8\""} [package.extras] azureservicebus = ["azure-servicebus (>=0.21.1)"] @@ -1798,9 +1787,6 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] @@ -1964,7 +1950,6 @@ python-versions = ">=3.6" atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<1.0.0a1" @@ -2412,7 +2397,6 @@ optional = false python-versions = ">=3.6" [package.dependencies] -importlib-metadata = {version = ">=1.7.0", markers = "python_version < \"3.8\""} pbr = ">=2.0.0,<2.1.0 || >2.1.0" [[package]] @@ -2531,7 +2515,7 @@ python-versions = "*" name = "typing-extensions" version = "3.10.0.0" description = "Backported and Experimental Type Hints for Python 3.5+" -category = "main" +category = "dev" optional = false python-versions = "*" @@ -2611,18 +2595,6 @@ python-versions = "*" [package.dependencies] pycryptodome = "*" -[[package]] -name = "zipp" -version = "3.4.1" -description = "Backport of pathlib-compatible object wrapper for zip files" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] - [extras] ldap = ["django-auth-ldap"] s3 = ["boto3", "django-storages"] @@ -2631,8 +2603,8 @@ xapian = ["xapian-haystack"] [metadata] lock-version = "1.1" -python-versions = "^3.7" -content-hash = "ece8bce6b86fecc86d3f19eeb1d1f4682213c8a8cc253fddb37a432bdeb604ea" +python-versions = "^3.9" +content-hash = "018e1ad1970093f5ea8ddb246d87face02df8e03ceec4df616e3be2b3eb18491" [metadata.files] alabaster = [ @@ -3084,6 +3056,10 @@ django-timezone-field = [ {file = "django-timezone-field-4.1.2.tar.gz", hash = "sha256:cffac62452d060e365938aa9c9f7b72d70d8b26b9c60243bce227b35abd1b9df"}, {file = "django_timezone_field-4.1.2-py3-none-any.whl", hash = "sha256:897c06e40b619cf5731a30d6c156886a7c64cba3a90364832148da7ef32ccf36"}, ] +django-titofisto = [ + {file = "django-titofisto-0.1.0.tar.gz", hash = "sha256:489362877d2efeddc7bd1209ce9f919b458d657a952ed5952d5364bbf834663a"}, + {file = "django_titofisto-0.1.0-py3-none-any.whl", hash = "sha256:5215e9b153b500c8e813632a2c024b0e34c4ddedeb321cd34e9bb1e7ba3e7237"}, +] django-two-factor-auth = [ {file = "django-two-factor-auth-1.13.1.tar.gz", hash = "sha256:a20e03d256fd9fd668988545f052cedcc47e5a981888562e5e27d0bb83deae89"}, {file = "django_two_factor_auth-1.13.1-py2.py3-none-any.whl", hash = "sha256:d270d4288731233621a9462a89a8dfed2dcb86fa354125c816a89772d55f9e29"}, @@ -3128,6 +3104,7 @@ flake8-bandit = [ ] flake8-black = [ {file = "flake8-black-0.2.1.tar.gz", hash = "sha256:f26651bc10db786c03f4093414f7c9ea982ed8a244cec323c984feeffdf4c118"}, + {file = "flake8_black-0.2.1-py3-none-any.whl", hash = "sha256:941514149cb8b489cb17a4bb1cf18d84375db3b34381bb018de83509437931a0"}, ] flake8-builtins = [ {file = "flake8-builtins-1.5.3.tar.gz", hash = "sha256:09998853b2405e98e61d2ff3027c47033adbdc17f9fe44ca58443d876eb00f3b"}, @@ -3185,10 +3162,6 @@ imagesize = [ {file = "imagesize-1.2.0-py2.py3-none-any.whl", hash = "sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1"}, {file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"}, ] -importlib-metadata = [ - {file = "importlib_metadata-4.0.1-py3-none-any.whl", hash = "sha256:d7eb1dea6d6a6086f8be21784cc9e3bcfa55872b52309bc5fad53a8ea444465d"}, - {file = "importlib_metadata-4.0.1.tar.gz", hash = "sha256:8c501196e49fb9df5df43833bdb1e4328f64847763ec8a50703148b73784d581"}, -] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, @@ -3895,7 +3868,3 @@ yubiotp = [ {file = "YubiOTP-1.0.0.post1-py2.py3-none-any.whl", hash = "sha256:7ad57011866e0bc6c6d179ffbc3926fcc0e82d410178a6d01ba4da0f88332878"}, {file = "YubiOTP-1.0.0.post1.tar.gz", hash = "sha256:c13825f7b76a69afb92f19521f4dea9f5031d70f45123b505dc2e0ac03132065"}, ] -zipp = [ - {file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"}, - {file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"}, -] diff --git a/pyproject.toml b/pyproject.toml index d938e3e89ce2d2b6330b818518a3f3dde74a5edc..03b6facc834739492d121d7b0b5fbfed5a281582 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ url = "https://edugit.org/api/v4/projects/461/packages/pypi/simple" secondary = true [tool.poetry.dependencies] -python = "^3.7" +python = "^3.9" Django = "^3.2" django-any-js = "^1.1" django-debug-toolbar = "^3.2" @@ -99,6 +99,7 @@ django-cleanup = "^5.1.0" djangorestframework = "^3.12.4" Whoosh = {version = "^2.7.4", optional = true} xapian-haystack = {version = "^2.1.1", optional = true} +django-titofisto = "^0.1.0" [tool.poetry.extras] ldap = ["django-auth-ldap"]