Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Django 5.0 ? #142

Open
Sakiut opened this issue Oct 4, 2024 · 1 comment
Open

Not working with Django 5.0 ? #142

Sakiut opened this issue Oct 4, 2024 · 1 comment

Comments

@Sakiut
Copy link

Sakiut commented Oct 4, 2024

Hello there!

I recently tried to upgrade my project dependencies from 4.2 to django 5.0 as part of a major upgrade and all of a sudden in my deploy process the collectstatic job went back to its default behaviour, collecting files to /app/static. No sign of error in none of my containers.

After a while, I found out that downgrading django back to 4.2 resolved the problem, with no other modification of my code base the static files deployed to minio again.

Please let me know if you have any idea of what could cause my issues, here are some relevant parts of my project code base:

requirements.txt

django~=4.2
django-filter~=23.3
django-jazzmin~=3.0
django-minio-storage~=0.5
django-phonenumber-field~=7.2
djangorestframework~=3.14
django-import-export~=4.1.1

gunicorn~=23.0
markdown~=3.5

phonenumbers~=8.13
psycopg2-binary~=2.9
python-dateutil~=2.9
fpdf2~=2.7
atlassian-python-api~=3.4
pypdf~=4.0
pyhanko~=0.23
openpyxl~=3.1.5

settings.py (Static files config part)

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder'
)
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'assets-static')  # vite-built assets directory for js dependencies
]

DEFAULT_FILE_STORAGE = "minio_storage.storage.MinioMediaStorage"
STATICFILES_STORAGE = "minio_storage.storage.MinioStaticStorage"

MINIO_STORAGE_ENDPOINT = os.environ.get("MINIO_URL")
MINIO_STORAGE_ACCESS_KEY = os.environ.get("MINIO_ACCESS_KEY")
MINIO_STORAGE_SECRET_KEY = os.environ.get("MINIO_PRIVATE_KEY")
MINIO_STORAGE_USE_HTTPS = bool(os.environ.get("MINIO_USE_HTTPS"))

MINIO_STORAGE_MEDIA_OBJECT_METADATA = {"Cache-Control": "max-age=1000"}
MINIO_STORAGE_MEDIA_BUCKET_NAME = 'media'
MINIO_STORAGE_MEDIA_BACKUP_BUCKET = 'Recycle Bin'
MINIO_STORAGE_MEDIA_BACKUP_FORMAT = '%c/'
MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET = True

MINIO_STORAGE_STATIC_BUCKET_NAME = 'static'
MINIO_STORAGE_AUTO_CREATE_STATIC_BUCKET = True
@elterrien
Copy link

Hello,

Replace DEFAULT_FILE_STORAGE and STATICFILES_STORAGE by https://docs.djangoproject.com/fr/5.1/ref/settings/#std-setting-STORAGES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants