Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[py3] Fixed filesystem encoding handling

in the app directories template loader.
  • Loading branch information...
commit fa4cb348170134fce7e99eedf497ee8f5e0fe165 1 parent a4abe7e
@aaugustin aaugustin authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 django/template/loaders/
8 django/template/loaders/
@@ -12,9 +12,11 @@
from django.template.loader import BaseLoader
from django.utils._os import safe_join
from django.utils.importlib import import_module
+from django.utils import six
# At compile time, cache the directories to search.
-fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
+if not six.PY3:
+ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
app_template_dirs = []
for app in settings.INSTALLED_APPS:
@@ -23,7 +25,9 @@
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')
if os.path.isdir(template_dir):
- app_template_dirs.append(template_dir.decode(fs_encoding))
+ if not six.PY3:
+ template_dir = template_dir.decode(fs_encoding)
+ app_template_dirs.append(template_dir)
# It won't change, so convert it to a tuple to save memory.
app_template_dirs = tuple(app_template_dirs)

0 comments on commit fa4cb34

Please sign in to comment.
Something went wrong with that request. Please try again.