aboutsummaryrefslogtreecommitdiff
path: root/clesana
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-10-29 14:54:38 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-10-29 14:54:38 +0100
commit7163dfa3d0252067de90e8c088ea90d0b0f7d059 (patch)
tree11fa27982ff2c328435a128df3a8ab44b25593f7 /clesana
parenta5fbd781ccc9b64483cc499c375fa6e0e99ade1d (diff)
Load a collection from command line and show a list of items
Diffstat (limited to 'clesana')
-rwxr-xr-xclesana21
1 files changed, 20 insertions, 1 deletions
diff --git a/clesana b/clesana
index 492c74c..13c8ba7 100755
--- a/clesana
+++ b/clesana
@@ -1,16 +1,35 @@
#!/usr/bin/env python3
+import sys
+
+import lesana
import cherrypy
import cherry_lesana as cl
+from pkg_resources import resource_filename
+
def main():
# TODO: read config from a file or something
config = {
'/': {
+ 'tools.staticdir.root': resource_filename(
+ 'cherry_lesana',
+ 'data',
+ )
},
+ '/static': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': 'static',
+ }
}
- cherrypy.quickstart(cl.App(), '/', config)
+ # TODO: properly read command line args
+ try:
+ collection = lesana.Collection(sys.argv[1])
+ except IndexError:
+ collection = None
+ app = cl.App(collection)
+ cherrypy.quickstart(app, '/', config)
if __name__ == '__main__':
main()