管理对胡夫/金字塔应用程序的脚本支持
khufu_script的Python项目详细描述
概述
khufu脚本为khufu/金字塔项目提供了一个manage脚本。 遵循通常的khufu意见,某些命令假定 您正在使用sqlalchemy来管理数据。
用法
使用khufu脚本可以很容易地定义和注册运行程序 使用disutils控制台脚本入口点。
例如,考虑一个基于金字塔的web应用程序,它有一个分发名称 “记事本”和“记事本”的主包装。
首先使用以下内容创建notetaker/manage.py:
import khufu_script settings = { 'sqlalchemy.url': 'sqlite:///notetaker.db' } main = khufu_script.make_manager(name='NoteTaker', app_factory='notetaker.app', config_filename='notetaker-settings.ini', settings=settings, db_metadatas=['notetaker.models.Base.metadata']).main if __name__ == '__main__': main()
下一步调整setup.py:
from setuptools import setup setup(name='NoteTaker', # ... entry_points={ 'console_scripts': [ 'notetaker-manage = notetaker.manage:main', ] } )
安装应用程序后,您可以键入:
$ notetaker-manage
或者直接运行模块:
$ python -m notetaker.manage
可用命令
Commands: runserver Run a reloadable development web server. loaddata Add data based on the YAML from filename shell Launch a Python shell syncdb Ensure all database tables exist
学分
由Rocky Burt<;Rocky在服务器上创建和维护。
更改
0.6.2(2011年8月29日)
- syncdb/upgradedb now reflect on the database more to avoid circular model dependencies
0.6.1(2011年7月10日)
- Added “rshell” command for connecting to a remote rfoo server and work with live-running objects
0.6(2011年5月14日)
- first release