/usr/share/doc/python-werkzeug-doc/examples/manage-simplewiki.py is in python-werkzeug-doc 0.9.4+dfsg-1.1ubuntu2.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Manage SimpleWiki
~~~~~~~~~~~~~~~~~
This script provides some basic commands to debug and test SimpleWiki.
:copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
from werkzeug import script
def make_wiki():
"""Helper function that creates a new wiki instance."""
from simplewiki import SimpleWiki
database_uri = os.environ.get('SIMPLEWIKI_DATABASE_URI')
return SimpleWiki(database_uri or 'sqlite:////tmp/simplewiki.db')
def shell_init_func():
"""
Called on shell initialization. Adds useful stuff to the namespace.
"""
from simplewiki import database
wiki = make_wiki()
wiki.bind_to_context()
return {
'wiki': wiki,
'db': database
}
action_runserver = script.make_runserver(make_wiki, use_reloader=True)
action_shell = script.make_shell(shell_init_func)
def action_initdb():
"""Initialize the database"""
make_wiki().init_database()
if __name__ == '__main__':
script.run()
|