How to comment/remove all print statements from Python codebase?
I am using below settings to secure Django application with Gunicorn+NGINX
# https://docs.djangoproject.com/en/3.1/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'your-django-site-domain.com']
# https://docs.djangoproject.com/en/3.1/ref/settings/#debug
DEBUG = False
# https://docs.djangoproject.com/en/3.1/ref/settings/#secure-hsts-seconds
sudo su postgres
psql mydatabase -c "GRANT ALL ON ALL TABLES IN SCHEMA public to dbuser;"
psql mydatabase -c "GRANT ALL ON ALL SEQUENCES IN SCHEMA public to dbuser;"
psql mydatabase -c "GRANT ALL ON ALL FUNCTIONS IN SCHEMA public to dbuser;"
Create a Credentials object from the service account's credentials and the scopes your application needs access to.
https://developers.google.com/identity/protocols/oauth2/service-account#authorizingrequests
from google.oauth2 import service_account
SCOPES = ['https://www.googleapis.com/auth/sqlservice.admin']
SERVICE_ACCOUNT_FILE = '/path/to/service.json'
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE, scopes=SCOPES)
You need ensure:
/home/ufo ownership is 700
/home/ufo/.ssh ownership is 700
/home/ufo/.ssh/authorized_keys ownership is 600
Well in my case the issue was happening because the box on which my server was hosted was hitting 100% Disk Usage and thus nginx was failing while writing the access logs.Just adding this in case someone hits the same issue. And so it might mean that there is some other issue and you should debug from a more holistic view.