Kegbot / kegbot-server

Kegbot Server, the internet beer kegerator monitoring system.
https://docs.kegbot.org/projects/kegbot-server/
MIT License
194 stars 103 forks source link

Setting Debug = False (KEGBOT_ENV = production) breaks user uploaded images #415

Closed myrison closed 2 years ago

myrison commented 4 years ago

When debug = false, Django only serves images from the defined 'static' location, but the user-uploaded images in the web UI (i.e. beer labels) break when debug is set to false. This seems to be for two reasons 1) the function that defines the URL on these pages does not apply logic to adjust from /media to /static, and when debug = false, and 2) there is not a function to copy these images (I think via django's collectstatic function) to the /static directory once they are uploaded. The following templates are affected, there may be others as well:

/app/pykeg/web/kegweb/templates/kegweb/includes/tap_snapshot.html and /app/pykeg/web/kegweb/templates/kegweb/keg-snapshot.html

mik3y commented 4 years ago

Definitely looks like a bug, thanks! I'll give a look, though if you've already got a patch that's welcome too.

myrison commented 4 years ago

Thanks for responding. I wish I could fix it on my own but after quite a bit of effort the best I could do was diagnose what was causing the problem. Thanks for taking a look when you can.

On Sat, Aug 22, 2020 at 09:35 mike w notifications@github.com wrote:

Definitely looks like a bug, thanks! I'll give a look, though if you've already got a patch that's welcome too.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kegbot/kegbot-server/issues/415#issuecomment-678654967, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBT6JKY74AIKWDX2GNRJMDSB7QTXANCNFSM4QFBXCQQ .

-- Sent from my mobile