summaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2017-03-26 10:19:59 +0100
committerMichaël Ball <michael.ball@gmail.com>2017-06-04 07:37:53 +0100
commitd06f96388d754ed41876f7fccb63f84241d44963 (patch)
tree640a4f3eaf7e1f2b76a246a1977c27775d0b59a1 /app.py
parentcaa1c3ccdf94ee20140b3964aab0ad3058e03699 (diff)
Works on python 2/pypy
Diffstat (limited to 'app.py')
-rw-r--r--app.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/app.py b/app.py
new file mode 100644
index 0000000..74d87d8
--- /dev/null
+++ b/app.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+"""Runs mach2."""
+from gevent import joinall, monkey, spawn
+from gevent.pywsgi import WSGIServer
+monkey.patch_all(thread=False)
+
+from six.moves import configparser # NOQA : E402
+
+from mach2 import create_app # NOQA : E402
+from watcher import LibraryWatcher # NOQA : E402
+
+APP = create_app()
+
+
+if __name__ == "__main__":
+ config = configparser.ConfigParser()
+ config.read("mach2.ini")
+ watcher = spawn(LibraryWatcher, config.get("DEFAULT", "media_dir"),
+ config.get("DEFAULT", "library"))
+
+ http_server = WSGIServer(('', 5000), APP, log=None)
+ server = spawn(http_server.serve_forever)
+
+ joinall([server, watcher])