Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Django 1.10 enforce templates to be defined in the settings file?

Tags:

django

I get the following warning while running various manage.py commands in my Django 1.9.8 project:

/usr/local/lib/python2.7/dist-packages/django/template/utils.py:37:
RemovedInDjango110Warning: You haven't defined a TEMPLATES setting. You must 
do so before upgrading to Django 1.10. Otherwise Django will be unable to load 
templates. "unable to load templates.", RemovedInDjango110Warning)

Why is this needed starting from Django 1.10 ? I use Django mainly for creating APIs solely, and usually have no reason to use a templating engine producing HTML or whatnot.

like image 835
Niklas9 Avatar asked Jan 19 '26 04:01

Niklas9


1 Answers

RemovedInDjango110Warning: You haven't defined a TEMPLATES setting. You must do so before upgrading to Django 1.10. Otherwise Django will be unable to load templates.

This means that if you do nothing you won't be able to load templates. Which should none of your concerns if you don't use templates.

If you want to dismiss this warning in Django < 1.10, you can set it to a non-empty list:

TEMPLATES = [{}]

As of the reason why it is now "required" (actually in your case it's not), it is explained in Django 1.8 releases notes:

As a consequence of the multiple template engines refactor, several settings are deprecated in favor of TEMPLATES

like image 172
Antoine Pinsard Avatar answered Jan 21 '26 03:01

Antoine Pinsard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!