When deoploying my website with Heroku, I run into the following issue:
ModuleNotFoundError: No module named 'qr_code'
so the website doesn't deploy
This is the log tail:
My requirements.txt
contains the following:
asgiref==3.5.0
Django==4.0.3
django-qr-code==3.0.0
gunicorn==20.1.0
qrcode==7.3.1
segno==1.4.1
sqlparse==0.4.2
My Procfile
:
web: gunicorn qrcode.wsgi
qrcode is the name of the folder containing the settings and wsgi file.
I have tried:
- adding
qr_code
to the requirements - reinstalling the qr_code module
- rewriting the
requirements.txt
viapip freeze > requirements.txt
and then committing
CodePudding user response:
It looks like you have a typo in your settings.py
. Something like this:
INSTALLED_APPS = [
# ...
'qr_code',
# or
'qr_code.apps.Qr_CodeConfig',
]
If your app is called qrcode
, that's what should be in INSTALLED_APPS
:
INSTALLED_APPS = [
# ...
'qrcode',
# or
'qrcode.apps.QrCodeConfig',
]
I see that you are also depending on the qrcode
module from PyPI. Having two modules named qrcode
in the same project is likely to create problems. For example, when you import qrcode
you'll probably get your own app, not the library you're looking for.
Assuming that's true, consider naming your own app something different.