PyCharm Not Properly Recognizing Requirements - Python, Django

后端 未结 4 1203
别那么骄傲
别那么骄傲 2021-02-03 20:53

Often requirements show up in requirements.txt like this:

django-registration

But in INSTALLED_APPS it appears as re

相关标签:
4条回答
  • 2021-02-03 21:25

    PyCharm should be able to figure this out, but it doesn't. For now, I just add # noinspection PyPackageRequirements to each import with this warning to suppress it. I'd rather not, but it works for now.

    0 讨论(0)
  • 2021-02-03 21:37

    JetBrains claims that this is fixed in version 2017.2:

    https://youtrack.jetbrains.com/issue/PY-11963#comment=27-2248728

    I can confirm this (in IntelliJ IDEA). Also, it's worth double-checking that the correct requirements file is specified in Settings -> Tools -> Python Integrated Tools -> Package requirements file

    0 讨论(0)
  • 2021-02-03 21:44

    This seem to be an open issue

    https://youtrack.jetbrains.com/issue/PY-11963

    0 讨论(0)
  • 2021-02-03 21:47

    After seeing this phenomenon again, I did some more digging. After setting certain folders as source roots and restarting PyCharm, these reference warnings went away. I think this is a bug in PyCharm.

    0 讨论(0)
提交回复
热议问题