amara and django - python

I am trying to do webservice calls with django views using Amara library.
However anytime I do import amara (by simply importing it!) and call a django view with it imported, I get such errors:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:4444/test
Django Version: 1.2.1
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'azula.epgdb',
'django_extensions']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
80. response = middleware_method(request)
File "/usr/local/lib/python2.6/dist-packages/django/middleware/common.py" in process_request
58. _is_valid_path("%s/" % request.path_info, urlconf)):
File "/usr/local/lib/python2.6/dist-packages/django/middleware/common.py" in _is_valid_path
143. urlresolvers.resolve(path, urlconf)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
301. return get_resolver(urlconf).resolve(path)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
216. sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
123. return self.callback, args, kwargs
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in _get_callback
129. self._callback = get_callable(self._callback_str)
File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py" in wrapper
124. result = func(*args)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in get_callable
56. lookup_view = getattr(import_module(mod_name), func_name)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py" in import_module
35. __import__(name)
File "/home/uluc/azula/epgdb/views.py" in <module>
4. from azula.epgdb.utils import EventSet
File "/home/uluc/azula/epgdb/utils.py" in <module>
6. import amara
File "/usr/lib/pymodules/python2.6/amara/__init__.py" in <module>
11. import binderytools
File "/usr/lib/pymodules/python2.6/amara/binderytools.py" in <module>
13. from Ft.Xml import InputSource
File "/usr/lib/python2.6/dist-packages/Ft/Xml/InputSource.py" in <module>
355. DefaultFactory = InputSourceFactory(catalog=GetDefaultCatalog())
File "/usr/lib/python2.6/dist-packages/Ft/Xml/Catalog.py" in GetDefaultCatalog
579. catalog = Catalog(uri, quiet)
File "/usr/lib/python2.6/dist-packages/Ft/Xml/Catalog.py" in __init__
95. self._parseXmlCat(data)
File "/usr/lib/python2.6/dist-packages/Ft/Xml/Catalog.py" in _parseXmlCat
372. from Ft.Xml.Sax import CreateParser
File "/usr/lib/python2.6/dist-packages/Ft/Xml/Sax.py" in <module>
242. class SaxPrinter(ContentHandler):
File "/usr/lib/python2.6/dist-packages/Ft/Xml/Sax.py" in SaxPrinter
247. def __init__(self, printer=XmlPrinter(sys.stdout, 'utf-8')):
File "/usr/lib/python2.6/dist-packages/Ft/Xml/Lib/XmlPrinter.py" in __init__
39. self.stream = sw = cStreamWriter.StreamWriter(stream, encoding)
Exception Type: TypeError at /test
Exception Value: argument must have 'write' attribute
How can this be solved ? I tried this under either Debian Lenny & Ubuntu 10.04 yet via Django SVN version and Amara 1
I am suspicious of some character encoding problem.

Putting "WSGIRestrictStdout Off" to my apache fixed the issue as said in here.

Related

Datafile not found, datafile generation failed in confusable_homoglyphs/categories.py

I'm setting up a django project on an apache server. It is running fine on my PC under using manage.py runsslserver.
When I load onto the apache server I can run manage.py migrate and collectstatic and a number of setup programs.
BUT when I try to enter the webpage I get error message "Datafile not found, datafile generation failed" with this traceback:
Environment:
Request Method: GET
Request URL: https://ekim.hexiawebservices.co.uk/
Django Version: 1.11.5
Python Version: 2.7.12
Installed Applications:
['django.contrib.admin',
'registration',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'social_django',
'djangosecure',
'sslserver',
'ekim']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "/var/www/ekim/env/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
172. resolver_match = resolver.resolve(request.path_info)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/urls/resolvers.py" in resolve
362. for pattern in self.url_patterns:
File "/var/www/ekim/env/lib/python2.7/site-packages/django/utils/functional.py" in __get__
35. res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/urls/resolvers.py" in url_patterns
405. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/utils/functional.py" in __get__
35. res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/urls/resolvers.py" in urlconf_module
398. return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/var/www/ekim/ekim/urls.py" in <module>
30. url(r'^accounts/', include('registration.backends.hmac.urls')),
File "/var/www/ekim/env/lib/python2.7/site-packages/django/conf/urls/__init__.py" in include
50. urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/backends/hmac/urls.py" in <module>
10. from . import views
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/backends/hmac/views.py" in <module>
15. from registration.views import ActivationView as BaseActivationView
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/views.py" in <module>
12. from registration.forms import RegistrationForm
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/forms.py" in <module>
19. from . import validators
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/validators.py" in <module>
10. from confusable_homoglyphs import confusables
File "/var/www/ekim/env/lib/python2.7/site-packages/confusable_homoglyphs/confusables.py" in <module>
7. from .categories import unique_aliases, alias
File "/var/www/ekim/env/lib/python2.7/site-packages/confusable_homoglyphs/categories.py" in <module>
147. raise Exception('Datafile not found, datafile generation failed!')
Exception Type: Exception at /
Exception Value: Datafile not found, datafile generation failed!
I have been trying to sort this for 3 hours and cannot work it out. Any help greatly appreciated.
(I couldn't comment on the question because I don't have enough karma.)
You encountered this error because you rely on a library I wrote. It downloads some files from unicode.org whenever it gets loaded for the first time. Unfortunately I didn't expect a few use cases, for instance deploying apps with my lib as a dependency on Platforms as a Service, where dependencies would frequently get downloaded, which would also cause my lib to hit unicode.org much more frequently than I had expected.
Fortunately someone submitted a patch to the lib, fixing this issue for good. Please upgrade to confusable_homoglyphs>=3.0.0. :)
I have the same problem, and after doing some research I've discovered the source of the problem: the registration library requires confusable-homoglyphs, and confusable-homoglyphs looks for two files: categories.json and confusables.txt. If it doesn't find those files, it tries to download two files from unicode.org - Scripts.txt and confusables.txt - and generate the two json files from those. If you download those files too often, unicode.org will throttle your bandwidth and possibly even blacklist your address.
confusable-homoglyphs is hard-wired to put the files in the working directory returned by os.getcwd(), so I downloaded those files on a different computer and put them in my working directory. The Django migration was successful. I hope this works for you too!

django template errno 13

I have a problem with django template. I made new template file in pycharm and in code i think all is good. But i have errno 13 permission denied. Other templates are working fine.
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/Doggo/2/results/
Django Version: 1.11
Python Version: 3.6.1
Installed Applications:
['Doggo.apps.DoggoConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "C:\Python36-32\lib\site-packages\django\core\handlers\exception.py" in inner
41. response = get_response(request)
File "C:\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response
217. response = self.process_exception_by_middleware(e, request)
File "C:\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response
215. response = response.render()
File "C:\Python36-32\lib\site-packages\django\template\response.py" in render
107. self.content = self.rendered_content
File "C:\Python36-32\lib\site-packages\django\template\response.py" in rendered_content
82. template = self.resolve_template(self.template_name)
File "C:\Python36-32\lib\site-packages\django\template\response.py" in resolve_template
64. return select_template(template, using=self.using)
File "C:\Python36-32\lib\site-packages\django\template\loader.py" in select_template
48. return engine.get_template(template_name)
File "C:\Python36-32\lib\site-packages\django\template\backends\django.py" in get_template
39. return Template(self.engine.get_template(template_name), self)
File "C:\Python36-32\lib\site-packages\django\template\engine.py" in get_template
162. template, origin = self.find_template(template_name)
File "C:\Python36-32\lib\site-packages\django\template\engine.py" in find_template
136. name, template_dirs=dirs, skip=skip,
File "C:\Python36-32\lib\site-packages\django\template\loaders\base.py" in get_template
38. contents = self.get_contents(origin)
File "C:\Python36-32\lib\site-packages\django\template\loaders\filesystem.py" in get_contents
28. with io.open(origin.name, encoding=self.engine.file_charset) as fp:
Exception Type: PermissionError at /Doggo/2/results/
Exception Value: [Errno 13] Permission denied: 'C:\\Users\\noob1_000\\PycharmProjects\\eWybory\\Doggo\\templates'
i think i have permission to this folder because other templates are working.
I'm working on windows 10
I would recommend to go through this-
Also , the view that you uses the template are also in the same directory as other views since you said that other views are able to access their templates ?
Let me know , if this solves your problem
Maybe you are just forgetting to indicate the template path (template / app/index.html) in the views.py.

Django -- Models don't exist, but Django still loads them

Im getting a ProgrammingError when I try to delete a User object, this is wherever User.delete occurs, it even happens in the admin.
The Error
Django apparently 'thinks' that there's a relationship between auth_user and apiHandlers_cardholders which doesn't exist anywhere, the database doesn't have a column for this, and there is no models.[y nor admin.py in the app named apiHandlers , but Django expects it to, there is even a section of the Admin site devoted to it. This only started happening when I migrated from SQLite to PostGreSQL.
At the moment all the local dependencies (models, admin, forms and fields) are in an app called helpers, I'm not sure if this is efficient, but it keeps everything in one place and avoids complications.
UPDATE 0.1
No. One of the probably gonna be many updates
I used to have a problem when migrating, related to Django Rest Framework, but I eventually managed to fix it by a quick pip install to a new update of restframework, it's no longer giving me any error while making migrations and migrating.
Below is the current traceback I'm getting from the Django admin, it's basically the same in the other deletion methods.
`
Environment:
Request Method: GET
Request URL: http://localhost:8000/admin/auth/user/3/delete/
Django Version: 1.9.2
Python Version: 2.7.10
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'corsheaders',
'oauth2_provider',
'apiHandlers',
'frontEnd',
'helpers',
'nonUser']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'corsheaders.middleware.CorsMiddleware',
'oauth2_provider.middleware.OAuth2TokenMiddleware']
Traceback:
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
541. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
244. return view(request, *args, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
67. return bound_func(*args, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
63. return func.__get__(self, type(self))(*args2, **kwargs2)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/utils/decorators.py" in inner
184. return func(*args, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/contrib/admin/options.py" in delete_view
1629. [obj], opts, request.user, self.admin_site, using)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/contrib/admin/utils.py" in get_deleted_objects
128. collector.collect(objs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/contrib/admin/utils.py" in collect
193. return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/models/deletion.py" in collect
230. elif sub_objs:
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/models/query.py" in __nonzero__
266. return type(self).__bool__(self)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/models/query.py" in __bool__
262. self._fetch_all()
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
1074. self._result_cache = list(self.iterator())
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/models/query.py" in __iter__
52. results = compiler.execute_sql()
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
848. cursor.execute(sql, params)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/utils.py" in __exit__
95. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/Mason/Documents/dev/FlowFrameWork/flow-framework/env/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /admin/auth/user/3/delete/
Exception Value: relation "apiHandlers_cardholder" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "apiHandle...
^
`
UPDATE 0.2
I am using ./manage.py runserver (Mac) to run it, so far I haven't managed to test it with Nginx and WSGI on my server.
I am not getting a warning saying that it could affect another model, in the admin, for example, I am just getting this error immediately.
This is very likely to be because you have a stray models.pyc file somewhere. Clear out all the *.pyc files. You can try something like this if you are on linux:
find . -name '*pyc' -exec 'rm' '{}' ';'
Follow that by ./manage.py makemigrations apihandlers and then ./manage.py migrate

Python http_client error [duplicate]

I am trying to create a simple API using django rest framework. In the view i have the following code.
from django.shortcuts import render
from moviestash.models import Movie
from moviestash.serializer import MovieSerializer
from rest_framework import generics
#List all movies and add movies
class MovieList(generics.ListCreateAPIView):
queryset = Movie.objects.all()
serializer_class = MovieSerializer
#Get a movie and delete a movie
class MovieDetail(generics.RetrieveDestroyAPIView):
queryset = Movie.objects.all()
serializer_class = MovieSerializer
when i run the server and try to go to any url i get the following error.
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.6
Python Version: 2.7.0
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'moviestash',
'south',
'rest_framework')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "N:\Python\venvs\rest_api\lib\site-packages\django\core\handlers\base.py" in get_response
101. resolver_match = resolver.resolve(request.path_info)
File "N:\Python\venvs\rest_api\lib\site-packages\django\core\urlresolvers.py" in resolve
318. for pattern in self.url_patterns:
File "N:\Python\venvs\rest_api\lib\site-packages\django\core\urlresolvers.py" in url_patterns
346. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "N:\Python\venvs\rest_api\lib\site-packages\django\core\urlresolvers.py" in urlconf_module
341. self._urlconf_module = import_module(self.urlconf_name)
File "N:\Python\venvs\rest_api\lib\site-packages\django\utils\importlib.py" in import_module
40. __import__(name)
File "N:\Python\movies_api\movies_api\urls.py" in <module>
10. url(r'^movies/', include('moviestash.urls')),
File "N:\Python\venvs\rest_api\lib\site-packages\django\conf\urls\__init__.py" in include
26. urlconf_module = import_module(urlconf_module)
File "N:\Python\venvs\rest_api\lib\site-packages\django\utils\importlib.py" in import_module
40. __import__(name)
File "N:\Python\movies_api\moviestash\urls.py" in <module>
3. from . import views
File "N:\Python\movies_api\moviestash\views.py" in <module>
4. from rest_framework import generics
File "N:\Python\venvs\rest_api\lib\site-packages\rest_framework\generics.py" in <module>
8. from rest_framework import views, mixins
File "N:\Python\venvs\rest_api\lib\site-packages\rest_framework\views.py" in <module>
14. from rest_framework.response import Response
File "N:\Python\venvs\rest_api\lib\site-packages\rest_framework\response.py" in <module>
8. from django.utils.six.moves.http_client import responses
Exception Type: ImportError at /
Exception Value: No module named http_client
When i go into the django shell and i can perform the following import with no issue from django.utils.six.moves import http_client. Also after i import http_client i also performed a dir(http_client) and i can see the responses object, but for some reason when i try to import using from django.utils.six.moves.http_client import responses i get an ImportError: No module named http_client. This is very frustrating to say the least.
It looks like you are hitting issue 2969. It should work if you upgrade from Django 1.6 to 1.6.11. However, please note that 1.6 is now end of life and does not receive security fixes, so ideally you should upgrade to the latest supported version of Django or the latest LTS.

Django attribute error: 'module' object has no attribute 'is_usable'

I got the following error when calling the url in Django.
It's working before, I guess it's related with some accidental changes I made, but I have no idea what they are.
Thanks before for the help,
Robert
Environment:
Request Method: GET Request URL: http://localhost:8000/time/ Django Version: 1.2 Python Version: 2.6.1 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'djlearn.books'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')
Traceback: File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response
100. response = callback(request, *callback_args,
**callback_kwargs) File "/Users/rhenru/Workspace/django/djlearn/src/djlearn/../djlearn/views.py" in current_datetime
16. return render_to_response('current_datetime.html',{'current_date':now,}) File "/Library/Python/2.6/site-packages/django/shortcuts/__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args,
**kwargs), **httpresponse_kwargs) File "/Library/Python/2.6/site-packages/django/template/loader.py" in render_to_string
181. t = get_template(template_name) File "/Library/Python/2.6/site-packages/django/template/loader.py" in get_template
157. template, origin = find_template(template_name) File "/Library/Python/2.6/site-packages/django/template/loader.py" in find_template
128. loader = find_template_loader(loader_name) File "/Library/Python/2.6/site-packages/django/template/loader.py" in find_template_loader
111. if not func.is_usable:
Exception Type: AttributeError at /time/ Exception Value: 'module' object has no attribute 'is_usable'
It looks like Django is looking for a usable template loader, but is finding something in settings.TEMPLATE_LOADERS that isn't honoring the template loader function protocol (described briefly here.)
Is it possible that one of your recent changes was to either settings.TEMPLATE_LOADERS or to a custom template loader? If the latter, your template function needs an is_usable attribute, presumably set to True.

Categories