Pycharm无法自动完成某些模块

问题描述 投票:0回答:3

Pycharm在大多数时候都运作良好。但是它无法自动完成一些代码。

以下“对象”无法完成。谁知道为什么?

我使用Pycharm社区版和Django 2.2

class SnippetList(APIView):
    """
    List all snippets, or create a new snippet.
    """

    def get(self, request):
        snippets = Snippet.objects.all()  # The objects can't be auto completed.
        serializer = SnippetSerializer(snippets, many=True)
        return Response(resp)

enter image description here

省电模式关闭。

enter image description here

python django visual-studio-code pycharm
3个回答
0
投票

有时,如果启用了节能模式,就会发生这种情况。检查右下角的帽子图标。

enter image description here


0
投票

Django是专业版的一部分,因此您需要它才能完成工作。参见this


0
投票

我找到了一个解决方案,它在对象级别有效,但在深度级别仍然无效。

pip install django-stubs
© www.soinside.com 2019 - 2024. All rights reserved.