lincolnloop / python-qrcode

Python QR Code image generator
https://pypi.python.org/pypi/qrcode
Other
4.34k stars 664 forks source link

I'm guessing you're using Django. So something like this: #259

Closed Rohit685 closed 2 years ago

Rohit685 commented 2 years ago

I'm guessing you're using Django. So something like this:

from qrcode import make
from django.contrib.staticfiles.storage import staticfiles_storage

qr = make(QRUrl)
with staticfiles_storage.open('myqr.png') as f:
    qr.save(f)

Originally posted by @SmileyChris in https://github.com/lincolnloop/python-qrcode/issues/258#issuecomment-1038381045

What if I'm using Flask?

SmileyChris commented 2 years ago

Then use the same method but with however you create a filelike object to your static files location.

Rohit685 commented 2 years ago

ok. I will try to find something like staticfiles_storage that is usable in Flask. Is there any other way of doing it?

Rohit685 commented 2 years ago

I think i figured it out thank you