{"action":"created","issue":{"url":"https://api.github.com/repos/divio/django-cms/issues/6323","repository_url":"https://api.github.com/repos/divio/django-cms","labels_url":"https://api.github.com/repos/divio/django-cms/issues/6323/labels{/name}","comments_url":"https://api.github.com/repos/divio/django-cms/issues/6323/comments","events_url":"https://api.github.com/repos/divio/django-cms/issues/6323/events","html_url":"https://github.com/divio/django-cms/issues/6323","id":307989226,"number":6323,"title":"{{ csrf_token }} inside of sekizai tag invalidates cache on every page load","user":{"login":"sniku","id":442646,"avatar_url":"https://avatars0.githubusercontent.com/u/442646?v=4","gravatar_id":"","url":"https://api.github.com/users/sniku","html_url":"https://github.com/sniku","followers_url":"https://api.github.com/users/sniku/followers","following_url":"https://api.github.com/users/sniku/following{/other_user}","gists_url":"https://api.github.com/users/sniku/gists{/gist_id}","starred_url":"https://api.github.com/users/sniku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sniku/subscriptions","organizations_url":"https://api.github.com/users/sniku/orgs","repos_url":"https://api.github.com/users/sniku/repos","events_url":"https://api.github.com/users/sniku/events{/privacy}","received_events_url":"https://api.github.com/users/sniku/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-23T11:14:21Z","updated_at":"2018-03-27T16:06:04Z","closed_at":"2018-03-27T16:06:04Z","author_association":"NONE","body":"There is `{{ csrf_token }}` template variable inside of the `{% addtoblock \"js\" %}` block in `cms/toolbar/toolbar_javascript.html`.\r\n\r\nFor logged in admin users, this variable changes on every page load. Since this variable is inside of the sekizai tag, it generates new .js file in `static/CACHE/js/`on every page load. \r\n\r\nThis causes 2 major problems for me:\r\n* disk space quickly runs out on the server, as the CACHE folder fills up with gigabytes of cached js files.\r\n* page loads are slower since sekizai compresses and caches js files on every page load\r\n\r\nHere's the snippet of code from `cms/toolbar/toolbar_javascript.html`.\r\n\r\n```html\r\n\r\n{% load i18n l10n sekizai_tags admin_static cms_tags cms_static %}\r\n\r\n{% addtoblock \"css\" %}<link rel=\"stylesheet\" href=\"{% static_with_version \"cms/css/cms.base.css\" %}\" />{% endaddtoblock %}\r\n\r\n{% addtoblock \"js\" %}\r\n<script src=\"{% static_with_version \"cms/js/dist/bundle.toolbar.min.js\" %}\" type=\"text/javascript\"></script>\r\n{% language request.toolbar.toolbar_language %}\r\n<script>\r\nCMS._plugins = [];\r\n// this is a global shared configuration\r\nCMS.config = {\r\n    'mode': {% if request.toolbar.edit_mode %}'draft'{% else %}'live'{% endif %},\r\n    'auth': {% if user.is_authenticated %}true{% else %}false{% endif %},\r\n    'debug': {% if debug %}true{% else %}false{% endif %},\r\n    'csrf': '{{ csrf_token }}',\r\n    'request': {\r\n        'language': '{{ request.GET.language|escape|escapejs }}',\r\n        'model': '{{ request.toolbar.get_object_model }}',\r\n        'page_id': '{% if request.current_page.publisher_is_draft %}{{ request.current_page.pk }}{% else %}{{ request.current_page.publisher_public_id }}{% endif %}',\r\n        'pk': '{{ request.toolbar.get_object_pk }}',\r\n        'url': '{% language request.toolbar.language %}{% cms_admin_url \"cms_page_resolve\" %}{% endlanguage %}',\r\n        'tree': '{% language request.toolbar.language %}{% cms_admin_url \"cms_page_changelist\" %}{% endlanguage %}'\r\n    },\r\n...\r\n```\r\n\r\nI suggest moving the `CMS.config = {...}` outside of the sekizai tag.\r\n"},"comment":{"url":"https://api.github.com/repos/divio/django-cms/issues/comments/376581309","html_url":"https://github.com/divio/django-cms/issues/6323#issuecomment-376581309","issue_url":"https://api.github.com/repos/divio/django-cms/issues/6323","id":376581309,"user":{"login":"czpython","id":994951,"avatar_url":"https://avatars0.githubusercontent.com/u/994951?v=4","gravatar_id":"","url":"https://api.github.com/users/czpython","html_url":"https://github.com/czpython","followers_url":"https://api.github.com/users/czpython/followers","following_url":"https://api.github.com/users/czpython/following{/other_user}","gists_url":"https://api.github.com/users/czpython/gists{/gist_id}","starred_url":"https://api.github.com/users/czpython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czpython/subscriptions","organizations_url":"https://api.github.com/users/czpython/orgs","repos_url":"https://api.github.com/users/czpython/repos","events_url":"https://api.github.com/users/czpython/events{/privacy}","received_events_url":"https://api.github.com/users/czpython/received_events","type":"User","site_admin":false},"created_at":"2018-03-27T16:06:04Z","updated_at":"2018-03-27T16:06:04Z","author_association":"OWNER","body":"Hello,\r\n\r\nThe cms does not support putting its internal js in compressor.\r\nWe already minify the internal js files.\r\nIf you want to use compressor with sekizai, please use a different block to add your custom styles, so instead of js block, you can use custom-js block and compress that one."}}
{"actor":{"display_login":"czpython"}}