Open urzbs opened 1 month ago
That's a weird one. PR to fix welcome.
Out of curiosity, does it work if you modify the installed apps with .append()
or with INSTALLED_APPS += [...]
? I'm asking as we do that for other apps:
Wondering if that would mess things up or if it's supported?
PS: not suitable for whitenoise
as it needs to be before staticfiles
, it's more of general question.
INSTALLED_APPS += ["whitenoise.runserver_nostatic"]
works too, but then its not on top of the list.
Not sure if it matters.
Yes I think it matters for whitenoise, as I said before, the order is important for this app, so your suggestion is better
Did you fill in a bug report by jetbrains?
Description:
We recently migrated a substantial project to the
django-cookiecutter
framework. Following this transition, we encountered significant issues with our IDE (PyCharm). Specifically, autocompletion within HTML templates stopped functioning correctly. This affected template tags such as{% include ... %}
and{% static ... %}
, which has been quite disruptive.Initially, we mitigated the problem for the
{% include ... %}
tag by marking template directories as "Template Directories." However, this solution did not resolve issues related to{% static ... %}
.Investigation:
We suspected that our project-specific configurations might be causing these issues. However, upon testing with an empty
django-cookiecutter
project, we found that the problem persisted. This led us to conclude that PyCharm's Django integration might be struggling to detect the Django structure in projects created withdjango-cookiecutter
.To pinpoint the issue, we incrementally recreated the cookiecutter setup to observe when PyCharm's integration failed. We identified the following line in
local.py
as the culprit:It appears that PyCharm is unable to handle the unpacking operation when reading the
INSTALLED_APPS
list. Therefore leading to"no apps found"
PyCharm message.Solution:
By modifying the
INSTALLED_APPS
assignment as shown below, PyCharm's Django integration functions correctly, and autocompletion is restored:This change allows PyCharm to detect the Django structure properly.
Attachments:
Test:
Tested with PyCharm Professional Build #PY-241.18034.82, built on June 24, 2024
This problem has also occured for older versions of PyCharm.