Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Customizing Django Templates Building Custom Tags DIY Custom Tags

Avani Agrawal
Avani Agrawal
1,638 Points

"from django import template" does not seem to recognize "template" and says unresolved reference. Any suggestions?

At the start of the course, as the first line of code to build custom templates is "from django import template". It does not seem to recognize "template" and hovering over the error says "unresolved reference". I have been using Pycharms throughout all the Python & Django courses and has worked out for me very well so far.

(I have created "templatetags" as a python package which automatically includes init.py file in it. )

Any help will be greatly appreciated! Thanks.

3 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

the class's name is Template, not template. Python cares about capitalization.

Avani Agrawal
Avani Agrawal
1,638 Points

Thanks for the answer Kenneth. However, the course starts with the import of template which is not capitalized either. I tried both 'template' and 'Template' but neither works. Not sure, if it is a bug in the IDE I have been using!

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Hmm, strange. I can do from django import template with no problems.

Avani Agrawal
Avani Agrawal
1,638 Points

Yes, it should, well, I googled a bit and the following link suggested that this is a known bug in pycharms, cleared the cache and it worked for me-

http://sopython.com/canon/40/pycharm-unresolved-references/

Thanks for your help Kenneth!