Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!