samedi 22 mai 2021

Getting Error => ModuleNotFoundError: No module named 'django' When I attempt to deploy my django app to heroku

When I attempt to deploy my django app to heroku, the deployment will fail with the following error message

Traceback (most recent call last):

  File "manage.py", line 11, in main

    from django.core.management import execute_from_command_line

ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "manage.py", line 23, in <module>

    main()

  File "manage.py", line 13, in main

    raise ImportError(

ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

Here is my requirements.txt

asgiref==3.3.4
dj-database-url==0.5.0
Django==3.2.3
django-cors-headers==3.7.0
django-on-heroku==1.1.2
djangorestframework==3.12.4
gunicorn==20.1.0
psycopg2-binary==2.8.6
python-dotenv==0.17.1
pytz==2021.1
sqlparse==0.4.1
whitenoise==5.2.0

My Procfile

release: python3 manage.py migrate
web: gunicorn app_name.wsgi --log-file -

And the buildpacks (using nodejs for the frontend)

1. heroku/nodejs
2. heroku/python

I have tried to deploy the app from both the CLI and a github repository. Both result in the same error.

I am happy to provide any additional information from the project if needed.

How can I fix this error so my app will deploy successfully?




Aucun commentaire:

Enregistrer un commentaire