I have deployed my app using some tutorial
I use nginx+gunicorn (also I use systemd)
Right now everything works fine on my dev server
But on production it fails with
Internal Server Error
when I try to download file
How and where can I find gunicorn logs? (I use ubuntu)
Also, this is piece of code that causes an error just in case:
def download_xlsx(request):
user = request.user
file_name = request.GET['file_name']
file_path='main_app/static/xlsx/' + str(user.id) + '/' + file_name
disposition= 'attachment; filename="' +smart_str(file_name) + '"'
disposition=disposition.encode('utf-8')
if os.path.exists(file_path):
with open(file_path, 'rb') as fh:
response = HttpResponse(fh.read(), content_type="application/vnd.ms-excel")
response['Content-Disposition'] = disposition
return response
return projects.to_utf8_json_response('not found')
UPD: I tried to run sudo journalctl -u gunicorn
But I get as a result a huge file starting 2 month ago, so I can't go to latest logs do to it's size
Seems to work like this:
journalctl --unit=gunicorn | tail -n 300
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With