{"action":"created","issue":{"url":"https://api.github.com/repos/centralniak/cmsplugin_gallery/issues/51","repository_url":"https://api.github.com/repos/centralniak/cmsplugin_gallery","labels_url":"https://api.github.com/repos/centralniak/cmsplugin_gallery/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/centralniak/cmsplugin_gallery/issues/51/comments","events_url":"https://api.github.com/repos/centralniak/cmsplugin_gallery/issues/51/events","html_url":"https://github.com/centralniak/cmsplugin_gallery/issues/51","id":357876864,"node_id":"MDU6SXNzdWUzNTc4NzY4NjQ=","number":51,"title":"AttributeError: 'Settings' object has no attribute 'TEMPLATE_LOADERS'","user":{"login":"tehfink","id":122166,"node_id":"MDQ6VXNlcjEyMjE2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/122166?v=4","gravatar_id":"","url":"https://api.github.com/users/tehfink","html_url":"https://github.com/tehfink","followers_url":"https://api.github.com/users/tehfink/followers","following_url":"https://api.github.com/users/tehfink/following{/other_user}","gists_url":"https://api.github.com/users/tehfink/gists{/gist_id}","starred_url":"https://api.github.com/users/tehfink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tehfink/subscriptions","organizations_url":"https://api.github.com/users/tehfink/orgs","repos_url":"https://api.github.com/users/tehfink/repos","events_url":"https://api.github.com/users/tehfink/events{/privacy}","received_events_url":"https://api.github.com/users/tehfink/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-07T00:28:41Z","updated_at":"2018-09-07T10:42:21Z","closed_at":null,"author_association":"NONE","body":"Fresh install of Django 1.11.15, cms 3.5.2, filer 1.3.2. After running `makemigrations`:\r\n```python\r\nTraceback (most recent call last):\r\n  File \"manage.py\", line 22, in <module>\r\n    execute_from_command_line(sys.argv)\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/django/core/management/__init__.py\", line 364, in execute_from_command_line\r\n    utility.execute()\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/django/core/management/__init__.py\", line 338, in execute\r\n    django.setup()\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/django/__init__.py\", line 27, in setup\r\n    apps.populate(settings.INSTALLED_APPS)\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/django/apps/registry.py\", line 108, in populate\r\n    app_config.import_models()\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/django/apps/config.py\", line 202, in import_models\r\n    self.models_module = import_module(models_module_name)\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/importlib/__init__.py\", line 126, in import_module\r\n    return _bootstrap._gcd_import(name[level:], package, level)\r\n  File \"<frozen importlib._bootstrap>\", line 994, in _gcd_import\r\n  File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\r\n  File \"<frozen importlib._bootstrap>\", line 955, in _find_and_load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 665, in _load_unlocked\r\n  File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\r\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/cmsplugin_gallery/models.py\", line 22, in <module>\r\n    localdata.TEMPLATE_CHOICES = utils.autodiscover_templates()\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/cmsplugin_gallery/utils.py\", line 41, in autodiscover_templates\r\n    if 'django.template.loaders.app_directories.Loader' in settings.TEMPLATE_LOADERS:\r\n  File \"/Users/tehfink/…/virtualenv/lib/python3.6/site-packages/django/conf/__init__.py\", line 57, in __getattr__\r\n    val = getattr(self._wrapped, name)\r\nAttributeError: 'Settings' object has no attribute 'TEMPLATE_LOADERS'\r\n```\r\n\r\nAccording to the [Django docs](https://docs.djangoproject.com/en/1.11/ref/templates/upgrading/), `TEMPLATE_LOADERS` may not necessarily be defined, and it seems that the template settings in 1.11 are namespaced in a dict. The following seems to function as a workaround:\r\n```python\r\nTEMPLATE_LOADERS = TEMPLATES[0]['OPTIONS']['loaders']\r\nTEMPLATE_DIRS = TEMPLATES[0]['DIRS']\r\n```"},"comment":{"url":"https://api.github.com/repos/centralniak/cmsplugin_gallery/issues/comments/419400507","html_url":"https://github.com/centralniak/cmsplugin_gallery/issues/51#issuecomment-419400507","issue_url":"https://api.github.com/repos/centralniak/cmsplugin_gallery/issues/51","id":419400507,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTQwMDUwNw==","user":{"login":"vinitkumar","id":537678,"node_id":"MDQ6VXNlcjUzNzY3OA==","avatar_url":"https://avatars0.githubusercontent.com/u/537678?v=4","gravatar_id":"","url":"https://api.github.com/users/vinitkumar","html_url":"https://github.com/vinitkumar","followers_url":"https://api.github.com/users/vinitkumar/followers","following_url":"https://api.github.com/users/vinitkumar/following{/other_user}","gists_url":"https://api.github.com/users/vinitkumar/gists{/gist_id}","starred_url":"https://api.github.com/users/vinitkumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinitkumar/subscriptions","organizations_url":"https://api.github.com/users/vinitkumar/orgs","repos_url":"https://api.github.com/users/vinitkumar/repos","events_url":"https://api.github.com/users/vinitkumar/events{/privacy}","received_events_url":"https://api.github.com/users/vinitkumar/received_events","type":"User","site_admin":false},"created_at":"2018-09-07T10:42:21Z","updated_at":"2018-09-07T10:42:21Z","author_association":"COLLABORATOR","body":"We can have something like this:\r\n\r\n```python\r\n        if is_django_18_or_later:\r\n            TEMPLATE_CONTEXT_PROCESSORS = settings['TEMPLATES'][0]['OPTIONS']['context_processors']\r\n            TEMPLATE_LOADERS = settings['TEMPLATES'][0]['OPTIONS']['loaders']\r\n        else:\r\n            TEMPLATE_CONTEXT_PROCESSORS = settings['TEMPLATE_CONTEXT_PROCESSORS']\r\n            TEMPLATE_LOADERS = settings['TEMPLATE_LOADERS']\r\n\r\n```\r\n\r\nI would suggest that you just define the TEMPLATE setting as per the docs and it should just for you. What the plugin is doing is here works for both old and new version of django, I myself use django1.11.15 and djangoCMS 3.5.2. "}}
{"actor":{"display_login":"vinitkumar"}}