def main(): if len(sys.argv) != 2: print >>sys.stderr, "Missing listen port" sys.exit(1) log.setup() log.to_console(log.logging.DEBUG) s = server.Server() s.mount(ExampleApp()) s.run(host='0.0.0.0', port=int(sys.argv[1]))
class Foo(db.BaseModel): bar = peewee.CharField() def test(): database = db.get_db() database.create_tables([TestModel, Foo]) print [f.get_column_type() for f in Foo._meta.sorted_fields] TestModel(name='foo').save() TestModel(name='bar').save() Foo(bar='foo').save() Foo(bar='bar').save() print shortcuts.model_to_dict(TestModel()) import sys log.setup() log.to_console(log.logging.DEBUG) plugin.load_plugin('woodstove.plugins.cors') plugin.load_plugin('woodstove.plugins.trace') plugin.load_plugin('woodstove.plugins.duration') plugin.load_plugin('woodstove.plugins.db') s = server.Server() s.mount(crud_factory(TestModel, '/test')) s.mount(crud_factory(Foo, '/foo')) s.import_apps() s.run(host='0.0.0.0', port=int(sys.argv[1])) if __name__ == '__main__': test()