I have a Django 2.0
application hosted on VPS and is run by running command in SSH terminal
/root/.local/bin/pipenv run /home/user/.local/share/virtualenvs/example.com-IuTkL8w_/bin/gunicorn myapp.wsgi:application --timeout 300 --workers 1 --log-level=DEBUG &
Till few hours of running the application server using above command, Ajax requests works fine but after few hours it constantly fails.
There are many processes running behind that Ajax request but could not figure out where the request is breaking, since logs displays in console until SSH is live after running the above command. And there is no mean to check for console log after terminating SSH and logging again.
Killing all running process and restarting serving using above command again starts working fine for few hours.
1. What could be the reason for this ghost issue?
2. Is there some way to view console log in between anytime after SSH login?
3. If not, how can I set the server to restart automatically periodically (since, it is working again after restarting the server)?
Edit 2
I see in browser's network console, it is giving
[Errno 5] Input/output error
on print()
statement.
I have bunch of print()
statements to see output in console like
print('----check_url')
print(check_url)
print('----product_id')
print(product_id)
Edit 3
I have following line in the code
with open(joined_path_with_file, 'wb') as f:
f.write(r.content)
Is the issue with this?