我已經使用Python粘貼部署腳本部署Flask + Gunicorn項目。然而,我不能在部署腳本中寫access_log_format((h)s%(l)s%(u)s%(t)s「%(r)s」%(s)s%(b)s 「%(f)」。因爲我們%(h)s格式在Paste Deploy腳本中有特殊含義。如文檔中所述:如何在Python中隱藏百分比字符粘貼部署配置文件?
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;
但是,我可以解決這個問題嗎?
你嘗試過包裝與引號括起來的? (例如'access_log_format ='%(h)s'') – Ofir
您可以將'access_log_format'字段移動到除[DEFAULT]之外的部分嗎?措詞意味着變量替換僅在該配置部分中起作用。 在我自己的金字塔應用程序中,日誌記錄配置看起來很像[金字塔日誌記錄配置]中找到的示例(http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html#日誌配置) –
@IanMarcinkowski不,我把它放在[server:main]部分,而不是[DEFAULT]之一。 – andy