diff options
author | Helmut Grohne <helmut@subdivi.de> | 2013-09-02 18:51:20 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2013-09-02 18:51:20 +0200 |
commit | 022985f098a206c3b7852fe08a798cd31623f10d (patch) | |
tree | 84a1a0b0a67fa95608641f8e47bd55e8c1cd11fb /webapp.py | |
parent | c0cd9df1e6cb63d524939028f5f6a07c2c8c3da5 (diff) | |
download | debian-dedup-022985f098a206c3b7852fe08a798cd31623f10d.tar.gz |
add option -d --database for db path to all scripts
Diffstat (limited to 'webapp.py')
-rwxr-xr-x | webapp.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,6 +1,7 @@ #!/usr/bin/python import datetime +import optparse import sqlite3 from wsgiref.simple_server import make_server @@ -237,7 +238,12 @@ class Application(object): return html_response(source_template.render(params)) def main(): - app = Application(sqlite3.connect("test.sqlite3")) + parser = optparse.OptionParser() + parser.add_option("-d", "--database", action="store", + default="test.sqlite3", + help="path to the sqlite3 database file") + options, args = parser.parse_args() + app = Application(sqlite3.connect(options.database)) app = SharedDataMiddleware(app, {"/": ("dedup", "static")}) make_server("0.0.0.0", 8800, app).serve_forever() |