#33001: ManifestStaticFilesStorage is problematic - need changes here -------------------------------------+------------------------------------- Reporter: Man Python | Owner: nobody Type: New feature | Status: new Component: File | Version: 3.2 uploads/storage | Severity: Normal | Resolution: Keywords: Static | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Man Python):
* status: closed => new * resolution: wontfix => Comment: Replying to [comment:1 Carlton Gibson]: > Hi. This behaviour has been unchanged since [https://docs.djangoproject.com/en/3.2/releases/1.7/#django-contrib- staticfiles ManifestStaticFilesStorage was introduced in Django 1.7]. You're welcome to make whatever adjustments you need in a subclass (or configure your webserver to route `styles.css?<HASH>` requests to the right file) but it's not something we can just change. > Well.. I think it should be changed as default with this settings to has static files due many problems around cache on servers and enviroment in case user can not recognize in first the problem around cache (not onlt CDN, etc. but dedicated solutions in panels for apache ngnix wsgi, pushion passenger). > You say "problematic" but don't explain that at all. Likely it's your set up but if you can narrow down a specific issue in Django we're happy to have a look. > Thanks There is many issues.. but I tired to report all. Eg. {{{ ?: (staticfiles.E002) The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting. }}} {{{ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "public/static") ] STATIC_ROOT = os.path.join(BASE_DIR, 'public/', 'static/') STATIC_DIR = os.path.join(BASE_DIR, 'public/', 'static/') MEDIA_ROOT = os.path.join(BASE_DIR, 'public/', 'media/') }}} Users on boards like stack suggesting to delete/comment - I still not understand the reason for this "separation". {{{ STATICFILES_DIRS = [ os.path.join(BASE_DIR, "public/static") ] }}} https://stackoverflow.com/questions/27213752/collecting-staticfiles- throws-improperlyconfigured Then sure.. working, but not the overided templates and css {{{ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'public/', 'static/') STATIC_DIR = os.path.join(BASE_DIR, 'public/', 'static/') MEDIA_ROOT = os.path.join(BASE_DIR, 'public/', 'media/') }}} Many aps need the STATICFILES_DIRS from INSTALLED_APPS and if not exist, then django not starting Then user starting combine with rename dirs, move dirs, and caching canchges.. the .pyc often not include changes in settings.py this doing problems (sure.. advanced user know about problem, but anyway something can be complicated and not included in right way - fast refresh server overloaded, this same on dev/debug in local what I meet [eg. debugpy lags]). Hash refresh for static can help to see current stage/session in relation to code change (eg. ?unixtime). Finally I have 2 dirs public and public2 {{{ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "./public2/static") ] STATIC_ROOT = os.path.join(BASE_DIR, 'public/', 'static/') STATIC_DIR = os.path.join(BASE_DIR, 'public/', 'static/') MEDIA_ROOT = os.path.join(BASE_DIR, 'public/', 'media/') }}} This is not end.. The collecstatic sucsks.. it's not copying this same from site- packages\django\contrib\admin\static\ https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/ Then overiding not working! Coz .css for overiding is differnt from site- packages\django\contrib\admin\static\admin\css\base.css Eg. original is: {{{ /* DJANGO Admin styles */ @import url(fonts.css); /* VARIABLE DEFINITIONS */ :root { --primary: #79aec8; --secondary: #417690; --accent: #f5dd5d; --primary-fg: #fff; --body-fg: #333; --body-bg: #fff; --body-quiet-color: #666; --body-loud-color: #000; }}} Copied {{{ /* DJANGO Admin styles */ @import url(fonts.css); body { margin: 0; padding: 0; font-size: 14px; font-family: "Roboto","Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif; color: #333; background: #fff; } }}} Who can discover the detail? It's impossible if dev is not advanced. Problematic, coz no logs around templates/loaders around with overriding or any of around. What user doing next.. trying with .html similary.. creating "template" dirs in project\static\admin\templates or project\app\admin\templates project\app\view\templates other experiments I found many this cases in boards and recognized this as experiments, other confused action. Eg. last talks on gitter django. I was not sure that with collectstatic the .html should was copied or not, and this same with other assets as js/css if current was changed (after django upgrade) The funny, that all issues I meet after upgrade django to newer. This same with DJrest, other aps/addons. This all made hard work around extends. Next.. Users experimenting with {{{ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ "admin/", "rest_framework/", "django_registration/" ], #'APP_DIRS': True, }}} Changing eg. to: {{{ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ BaseDir/, "Templates" "admin/", "rest_framework/", "django_registration/" ], 'APP_DIRS': True, }}} or {{{ 'DIRS': [ BaseDir/, "Public" "admin/", "rest_framework/", "django_registration/" ], }}} {{{ 'DIRS': [ BaseDir/, "Public2" "admin/", "rest_framework/", "django_registration/" ], }}} You know what I mind.. if not errors, logs, then experiments.. in browser logs have near ok all, but around mods from overiding it taking as orginal not moded files. Eg. disonance is coming for favicon.ico always.. if static give files.. and in browser/django log {{{ Not Found: /favicon.ico [10/Aug/2021 19:59:00] "GET /favicon.ico HTTP/1.1" 404 2640 }}} Why? Thx for attention. https://gitter.im/django/django?at=610ed8ab025d436054ba2d55 -- Ticket URL: <https://code.djangoproject.com/ticket/33001#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.dd0ed2e78165f6766ceb85ee1a3e12e9%40djangoproject.com.