APSL / puput

A Django blog app implemented in Wagtail
MIT License
629 stars 160 forks source link

Django 1.9 : Invalid template library specified. ImportError #116

Closed harshmalik closed 7 years ago

harshmalik commented 7 years ago

Invalid template library specified. ImportError raised when trying to load 'mainApp.templatetags.puput_tags': No module named urls

Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.9 Exception Type: InvalidTemplateLibrary Exception Value:

Invalid template library specified. ImportError raised when trying to load 'mainApp.templatetags.puput_tags': No module named urls

Exception Location: /usr/local/lib/python2.7/dist-packages/django/template/backends/django.py in get_package_libraries, line 148 Python Executable: /usr/bin/python Python Version: 2.7.6 Python Path:

['/home/harsh/Desktop/litwitrepo', '/usr/local/lib/python2.7/dist-packages/goodreads-0.2.4-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/rauth-0.7.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/xmltodict-0.11.0-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/nose-1.3.7-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

harshmalik commented 7 years ago

I downgraded to django 1.8.9 and now I get the error TemplateSyntaxError at /blog/

'puput_tags' is not a valid tag library: ImportError raised loading mainApp.templatetags.puput_tags: No module named urls

Request Method: GET Request URL: http://127.0.0.1:8000/blog/ Django Version: 1.8.9 Exception Type: TemplateSyntaxError Exception Value:

'puput_tags' is not a valid tag library: ImportError raised loading mainApp.templatetags.puput_tags: No module named urls

Exception Location: /usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py in load, line 1163 Python Executable: /usr/bin/python Python Version: 2.7.6 Python Path:

['/home/harsh/Desktop/litwitrepo', '/usr/local/lib/python2.7/dist-packages/goodreads-0.2.4-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/rauth-0.7.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/xmltodict-0.11.0-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/nose-1.3.7-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Server time: Thu, 15 Jun 2017 09:43:45 +0530

marctc commented 7 years ago

Can you show me your INSTALLED_APPS?

harshmalik commented 7 years ago

INSTALLED_APPS = [ 'djangocms_admin_style', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'mainApp', 'django_comments', 'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.facebook', 'allauth.socialaccount.providers.google',

'django_messages',
'cms',
'menus',
'treebeard',
'sekizai',

] from puput import PUPUT_APPS

INSTALLED_APPS += PUPUT_APPS

harshmalik commented 7 years ago

I happen to have the following code in my mainApp's templatetags folder in init. py file: from django.conf import settings

for a in settings.INSTALLED_APPS: try: path.extend(import(a + '.templatetags', {}, {}, ['']).path) except ImportError: pass

When I remove this the error is gone...What is wrong in this code!?

marctc commented 7 years ago

What is the purpose of that code?

harshmalik commented 7 years ago

It was there didn't know what for! Never mind issue resolved now