I have use Python Paste Deploy script to deploy a Flask+Gunicorn project. However, i can not write access_log_format in deploy script with (h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)". Because we %(h)s format has special meaning in Paste Deploy script. As descripted in the doc:
You can use variable substitution, which will pull variables from
the section [DEFAULT] (case sensitive!) with markers like %
(var_name)s. The special variable %(here)s is the directory
containing the configuration file;
However can i get around this?
There are two components of your application that you are trying to configure in this case - Gunicorn and your Flask application (which is using Paste Deploy). Gunicorn is responsible for the access logging, while Flask / Paste Deploy are configured using your existing configuration. Paste Deploy is responsible for the magical variable substitution in its own configuration files, which conflicts with the Gunicorn access log configuration.
You can provide a separate configuration file for Gunicorn, which will contain your access log formatting. For example:
gunicorn -c gunicorn.conf --paste demo.conf
gunicorn.conf: