tools.mako.collection_size = 500
tools.mako.directories = "path/to/templates"
私はこれらのオプションを指定しないとどのように私はこれらのオプションを指定するのですか?用two_configオプションを必要とすると言いますか
tools.mako.collection_size = 500
tools.mako.directories = "path/to/templates"
私はこれらのオプションを指定しないとどのように私はこれらのオプションを指定するのですか?用two_configオプションを必要とすると言いますか
http://cherrypy.readthedocs.org/en/latest/config.htmlはCherryPyに構成を行うには2つの一般的な方法があります
を開始するための優れた場所です。設定を何も指定しないと、すべての設定がデフォルト値になり、cherrypyアプリの起動時に設定が空であるという警告が表示されます。
最初のオプションは、設定ファイルを読み込むことです。これは次のように行われます。
include cherrypy
include os.path
# Create your application/page handlers here
if __name__ == '__main__':
global_conf_file = os.path.join(os.path.dirname(__file__, 'server.conf'))
cherrypy.config.update(global_conf_file)
cherrypy.quickstart(Myapp(), config=global_config_file)
これらの行は、直接[グローバル]の見出しで、設定ファイルに含めることができますので、ファイル全体は次のようになります。その場合は
[global]
tools.mako.collection_size = 500
tools.mako.directories = 'path/to/templates'
include cherrypy
# Create your application/page handlers here
if __name__ == '__main__':
my_config = {'/': {'tools.mako.collection_size': 500,
'tools.mako.directories': 'path/to/templates'}}
cherrypy.quickstart(Myapp(), my_config)
あなたの編集は私のフィードをトリガーさせ、そして、私は年齢に気付かなかった。例えば、次のように、あなたがメインのPythonモジュールに辞書としてそれらを含めることができ、別のファイルにあなたの設定オプションを置きたくありません回答や質問のしかたがない。 –