I am trying to deploy my Django Rest FrameWork project in Heroku but I got "Deployment failed" no module named 'rest_framework'
Traceback (most recent call last):
File "/app/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/app/.heroku/python/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/app/.heroku/python/lib/python3.9/site-packages/django/apps/config.py", line 224, in create
import_module(entry)
File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rest_framework'
I tried this command in my vscode terminal heroku run pip install djangorestframework
to try to install it in Heroku, I got a message successffuly installed but always deployement failed.
How can I fix this issue?
When I do heroku run pip freeze
:
appdirs==1.4.4
asgiref==3.4.1
certifi==2021.5.30
distlib==0.3.2
dj-database-url==0.5.0
Django==3.2.5
django-heroku==0.3.1
filelock==3.0.12
gunicorn==20.1.0
pipenv==2020.11.15
psycopg2==2.9.1
psycopg2-binary==2.9.1
pytz==2021.1
six==1.16.0
sqlparse==0.4.1
virtualenv==20.4.7
virtualenv-clone==0.5.4
whitenoise==5.2.0
djangorestframework doesn't exist.
my .gitignore file:
venv
*.pyc
staticfiles
.env
*.sqlite3
my Pipfile:
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[requires]
python_version = "3.6"
[packages]
"psycopg2-binary" = "*"
django-heroku = "*"
gunicorn = "*"
Procfile :
release: python manage.py makemigrations --no-input
release: python manage.py migrate --no-input
web: gunicorn my-app.wsgi
my requirements.txt:
asgiref==3.4.0
dj-database-url==0.5.0
Django==3.2.5
django-cors-headers==3.7.0
django-heroku==0.3.1
djangorestframework==3.12.4
psycopg2==2.9.1
pytz==2021.1
sqlparse==0.4.1
whitenoise==5.2.0
Aucun commentaire:
Enregistrer un commentaire