I have an Django app that features a QR code generator. It works as intended in my local development environment, but I can't seem to get it to work on PythonAnywhere. The other features of the app work in my PythonAnywhere testing environment. I would really love if anyone had some input. Thanks in advance!
I'm using a virtual environment for both local and prod. The relevant packages are Python 3.6.5, Django==2.2.3, qrcode==6.1, Pillow==6.2.1. Is there any way of confirming that my site is infact using the packages installed in my virtual env and not the global packages?
When I start a console using my virtualenv, I am able to import all of the above packages and generate a QR code without a problem. But when my Django site tries to do the same task (hopefully using the same venv and same packages) it throws an error.
The trackback is as follows (with some private info removed):
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/qrcode/image/pil.py" in <module> 6. from PIL import Image, ImageDraw
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/PIL/Image.py" in <module> 95. from . import _imaging as core
During handling of the above exception (cannot import name '_imaging'), another exception occurred:
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request)
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request)
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, callback_args, *callback_kwargs)
File "/home/ryangilmore/qr_docs/qr_docs/dochistory/views.py" in DocQR 164. code = doc.qrcode()
File "/home/ryangilmore/qr_docs/qr_docs/dochistory/models.py" in qrcode 179. code = qrcode.make(self.file.url)
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/qrcode/main.py" in make 11. return qr.make_image()
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/qrcode/main.py" in make_image 289. from qrcode.image.pil import PilImage
File "/home/ryangilmore/qr_docs/venv/lib/python3.6/site-packages/qrcode/image/pil.py" in <module> 8. import Image
Exception Type: ModuleNotFoundError at /qrcode/19 Exception Value: No module named 'Image'