p0815
p0815

Reputation: 13

Why can i use requests in Python shell but i get the error no module found in Django?

I get the error module not found when trying to import requests in Django.

I cannot get python module requests to work in Django. I have installed the module using pip in python and can import in the python terminal.

ModuleNotFoundError: No module named 'requests'

if I run the commands in python shell:

>>> import requests
>>> test = requests.get(url="http://192.168.9.186:2480/connect/test")

i get a htto 204 response but in django I just get the module error

Upvotes: 0

Views: 364

Answers (1)

p0815
p0815

Reputation: 13

Thanks @H4kor my naive understanding of Python and Django I assumed they were using the same code library. After I ran:

pip install requests

The code ran through and resolved the error. Appreciate the help for this novice.

Upvotes: 1

Related Questions