109👍
Just open the project view
(view->tool windows -> project). There right-click on your templates
-folder -> ‘mark directory as’-> Template directory
21👍
Try adding TEMPLATE_LOADERS
to your settings file if you don’t have it. I think PyCharm looks for it and doesn’t load it from Django default settings. It solved my problem.
settings.py:
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
- [Django]-Django and query string parameters
- [Django]-Django, creating a custom 500/404 error page
- [Django]-How to automatically run tests when there's any change in my project (Django)?
5👍
If you have marked directory as template directory, but still get the warning, you can try changing the single quotes to double quotes
def home(request):
return render_to_response('home.html')
change to this:
def home(request):
return render_to_response("home.html")
Hope this helps.
- [Django]-Django-allauth: Linking multiple social accounts to a single user
- [Django]-"{% extends %}" and "{% include %}" in Django Templates
- [Django]-Dropdown in Django Model
3👍
I am using PyCharm 2018.2. You can follow the next steps to mark a directory as a template directory, so PyCharm will not give you warnings, and you will be able to go to the template by pressing cmd + B
(Mac) or ctrl + B
(Windows/Linux):
- [Django]-When to use Serializer's create() and ModelViewset's perform_create()
- [Django]-Change model class name in Django admin interface
- [Django]-How do I create a slug in Django?
2👍
I had a similar issue that was cause by forgetting to include my app in settings.INSTALLED_APPS. Adding my app to the list cleared the inspection.
- [Django]-Get count of related model efficiently in Django
- [Django]-Django update queryset with annotation
- [Django]-Inject errors into already validated form?
1👍
It’s fixed when I assigned “Django project root” from settings to project destination.
- [Django]-How to translate a model label in Django Admin?
- [Django]-How to make two django projects share the same database
- [Django]-How to write setup.py to include a Git repository as a dependency