Django Rest Framework — no module named rest_framework

后端 未结 21 806
夕颜
夕颜 2021-02-01 00:23

I\'ve installed django rest framework using pip install djangorestframework yet I still get this error when I run \"python3 manage.py sycndb\":

相关标签:
21条回答
  • 2021-02-01 01:00

    (I would assume that folks using containers know what they're doing, but here's my two cents)

    Let's say you setup your project using cookiecutter-django and enabled the docker container support, be sure to update the pip requirements file with djangorestframework==<x.yy.z> (or whichever python dependency you're trying to install) and re-build the docker images (local and production).

    0 讨论(0)
  • 2021-02-01 01:01

    I recently installed the latest Django 3.1 and Django Rest Framework 3.11.1 libraries only to eventually realize Django 3.1 is not supported by DRF as of 11 April 2020. I did not realize that the exact releases mentioned need to be used.

    If you're pulling your hair out because you can't understand why DRF is not importing check these requirements and make sure your app is compatible.

    0 讨论(0)
  • 2021-02-01 01:03

    On Windows, with PowerShell, I had to close and reopen the console and then reactive the virtual environment.

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