Heroku and Django 2.x ModuleNotFoundError: No module named 'rest_auth' - django

I've installed django-rest-auth locally with Django 2.x and it works fine.
However, when I deploy to Heroku I get a "ModuleNotFoundError: No module named 'rest_auth'" error.
I made sure that the requirements.txt is OK (pip freeze).
I also ran commands with CLI and the Heroku CL interface : pip install django-rest-auth
Any ideas why it's not working?

Finally found the answer... I had to add the module ALSO to the pipfile and made sure to adapt the syntax like this :
In requirements.txt => django-rest-auth==0.9.3
In Pipfile => django-rest-auth = "==0.9.3"

Related

ModuleNotFoundError: No module named 'PIL' , A problem came when I run my Django Project

When I try to run my Django project, it came an error:'ModuleNotFoundError: No module named 'PIL''. I try install Pillow in my virtual environment, but it still can't work.
enter image description here
You can install package by :
pip install pillow

How to solve no module error when testing the code?

I faced the error No module named 'rest_framework' when testing the code, however rest_framework is installed and everything works just fine. The problem occurs only on tests. When I run pip3 install djangorestframework or python -m pip install djangorestframework , I get this Requirement already satisfied: Everything what I found in the internet did not help. Also I have the following error django.core.exceptions.ImproperlyConfigured: Requested setting REST_FRAMEWORK, but settings are not configured. You

How to install django in miniconda?

i want to develop django rest API in windows.
Due to some reason i have to use miniconda in my system.
My project location is c:/users/noman/dev/cardionic/ .
i create virtualenv 'env' using miniconda which is created in c:/user/noman/miniconda3/envs/env instead of base folder. I activate my env using 'activate env' and install django. I create new django project using 'django-admin startproject cardio' .
when i run 'python manage.py runserver' it generates "ModuleNotFoundError: No module named 'sqlparse' "
i have done my best but could not resolve this issue. Thanks in advance
First, Setup an environment
conda create — name django2 python>3.7
Switch to / Activate the environment
conda activate django2
Install Django — the default version was 2.2.1
conda install -v django
Encountered ModuleNotFoundError: No module named ‘sqlparse’ when running python manage.py runserver. This will resolved by conda install sqlparse.

No module named PIL in heroku though it is installed

I have been trying to deploy a Django application on Heroku.
Some background - I hadn't used virtual environment while building the application but while deploying it, I had to use it. I'm following this tutorial for deployment. https://medium.com/agatha-codes/9-straightforward-steps-for-deploying-your-django-app-with-heroku-82b952652fb4
Now I'm stuck in step-6. After creating a virtual environment I have freezed the dependencies into requirements.txt.
But when I open the deployed URL it says
ImportError at /
No module named PIL
though Pillow has been installed, it is there in requirements.txt and runs fine when hosted on a local server.
This is my requirements.txt.
certifi==2018.4.16
dj-database-url==0.5.0
Django==1.11.14
django-heroku==0.3.1
gunicorn==19.9.0
packaging==17.1
Pillow==5.2.0
pip-review==1.0
pipenv==2018.7.1
pkg-resources==0.0.0
psycopg2==2.7.5
pyparsing==2.2.0
pytz==2018.5
six==1.11.0
virtualenv==16.0.0
virtualenv-clone==0.3.0
whitenoise==3.3.1
Please help me with this.
Heroku? Access your application and manually run pip install -r requirements.txt, then turn the application off and back on again.
I had this problem before, this step solved my problem.
If you are doing this in your view
import PIL
do this
import Image
In my case I solved this issue by installing 'Pillow'... just try pip/pip3 install Pillow and add it to your requirements.txt file.

Django Twilio module is not getting installed on Heroku

I tried below 2 methods to install django_twilio module on Heroku
1) Ran 'heroku run pip install django-twilio'
2) Added 'twilio==3.6.3' to requirements.txt and start the server on heroku.
When I run 'heroku run pip freeze' I can see the twilio entry. But when I go into python and run 'import django_twilio' I get a module not found error.
Please suggest how to fix this on heroku. Same steps worked fine on my local machine.
You didn't add the proper requirement, you only installed the twilio library. Your requirements.txt should include the following line:
django-twilio==0.4
Which will include all the other dependencies you'll need. The full pip freeze, after installing django-twilio looks like this:
Django==1.5.5
django-twilio==0.4
httplib2==0.8
six==1.4.1
twilio==3.6.3
unittest2==0.5.1
As a rule of thumb, always run pip freeze > requirements.txt before pushing an update to Heroku (assuming new dependencies were installed), to make sure you have a complete snapshot of your environment.