Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/creactivistore/_templates/run.py_tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'creactivistore/_templates/run.py_tmpl')
-rw-r--r--creactivistore/_templates/run.py_tmpl34
1 files changed, 34 insertions, 0 deletions
diff --git a/creactivistore/_templates/run.py_tmpl b/creactivistore/_templates/run.py_tmpl
new file mode 100644
index 0000000..d50ecba
--- /dev/null
+++ b/creactivistore/_templates/run.py_tmpl
@@ -0,0 +1,34 @@
+# python import
+import os, sys, threading
+
+# sugar or debug root path factory
+try:
+ from sugar.activity import activity
+ BUNDLE = activity.get_bundle_path()
+except Exception, e:
+ BUNDLE = os.path.abspath('.')
+
+# add lib path to current python path
+sys.path.append(os.path.join(BUNDLE, 'lib'))
+
+# import server first
+from server.flask import app, run_app
+
+# triplestore import
+from triplestore import Runner
+Runner().run()
+
+# init controllers
+from {{package}} import controllers
+
+def stop_all():
+ # stop the threads
+ Runner().proc.kill()
+
+import atexit
+atexit.register(stop_all)
+
+run_app()
+
+while(True):
+ pass