Bläddra i källkod

better uwsgi runner for both web and webdav

Guénaël Muller 6 år sedan
förälder
incheckning
50bda15ef0
3 ändrade filer med 16 tillägg och 5 borttagningar
  1. 4 2
      README.md
  2. 9 0
      wsgi/web.py
  3. 3 3
      wsgi/webdav.py

+ 4 - 2
README.md Visa fil

@@ -84,10 +84,12 @@ create wsgidav configuration file for webdav:
84 84
 
85 85
 Run all services with uwsgi
86 86
 
87
+    # set tracim_conf_file path
88
+    set TRACIM_CONF_PATH="$(pwd)/development.ini"
87 89
     # pyramid webserver
88
-    uwsgi -d /tmp/tracim_web.log --http-socket :6543 --ini-paste-logged  development.ini -H env --pidfile /tmp/tracim_web.pid
90
+    uwsgi -d /tmp/tracim_web.log --http-socket :6543 --wsgi-file wsgi/web.py -H env --pidfile /tmp/tracim_web.pid
89 91
     # webdav wsgidav server
90
-    uwsgi -d /tmp/tracim_webdav.log --http-socket :3030 --wsgi-file wsgi//webdav.py  development.ini -H env --pidfile /tmp/tracim_webdav.pid
92
+    uwsgi -d /tmp/tracim_webdav.log --http-socket :3030 --wsgi-file wsgi/webdav.py -H env --pidfile /tmp/tracim_webdav.pid
91 93
 
92 94
 to stop them:
93 95
 

+ 9 - 0
wsgi/web.py Visa fil

@@ -0,0 +1,9 @@
1
+# coding=utf-8
2
+# Runner for uwsgi
3
+import os
4
+import pyramid.paster
5
+
6
+config_uri = os.environ['TRACIM_CONF_PATH']
7
+
8
+pyramid.paster.setup_logging(config_uri)
9
+application = pyramid.paster.get_app(config_uri)

+ 3 - 3
wsgi/webdav.py Visa fil

@@ -1,10 +1,10 @@
1 1
 # coding=utf-8
2 2
 # Runner for uwsgi
3 3
 from tracim.lib.webdav import WebdavAppFactory
4
+import os
4 5
 
5
-APP_CONFIG = "development.ini"
6
-
6
+config_uri = os.environ['TRACIM_CONF_PATH']
7 7
 app_factory = WebdavAppFactory(
8
-    tracim_config_file_path=APP_CONFIG,
8
+    tracim_config_file_path=config_uri,
9 9
 )
10 10
 application = app_factory.get_wsgi_app()