Bad request 400: nginx / gunicorn

I had the same problem and adding ALLOWED_HOSTS = (“yourdomain.com”,) to settings fixed it. UPDATE: there few other possibilities: Nginx (or whatever web server you use) doesn’t pass the $host variable to the app Host contains underscores See details: https://blog.anvileight.com/posts/how-to-fix-bad-request-400-in-django/

Frequent worker timeout

We had the same problem using Django+nginx+gunicorn. From Gunicorn documentation we have configured the graceful-timeout that made almost no difference. After some testings, we found the solution, the parameter to configure is: timeout (And not graceful timeout). It works like a clock.. So, Do: 1) open the gunicorn configuration file 2) set the TIMEOUT to … Read more

how to run gunicorn on docker

I just went through this problem this week and stumbled on your question along the way. Fair to say you either resolved this or changed approaches by now, but for future’s sake: The command in my Dockerfile is: CMD [“gunicorn” , “-b”, “0.0.0.0:8000”, “app:app”] Where the first “app” is the module and the second “app” … Read more

Make sure only one worker launches the apscheduler event in a pyramid web app running multiple workers

Because Gunicorn is starting with 8 workers (in your example), this forks the app 8 times into 8 processes. These 8 processes are forked from the Master process, which monitors each of their status & has the ability to add/remove workers. Each process gets a copy of your APScheduler object, which initially is an exact … Read more

Gunicorn can’t find app when name changed from “application”

Gunicorn (and most WSGI servers) defaults to looking for the callable named application in whatever module you point it at. Adding an alias from myproject import myapp as application or application = myapp will let Gunicorn discover the callable again. However, the wsgi.py file or the alias aren’t needed, Gunicorn can be pointed directly at … Read more

Sharing Memory in Gunicorn?

It looks like the easiest way to do this is to tell gunicorn to preload your application using the preload_app option. This assumes that you can load the data structure as a module-level variable: from flask import Flask from your.application import CustomDataStructure CUSTOM_DATA_STRUCTURE = CustomDataStructure(‘/data/lives/here’) # @app.routes, etc. Alternatively, you could use a memory-mapped file … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)