changeset 19:38235b614e3f

starting app script update moved pure wsgi app to libs,(since it's not needed)
author Marcin Kuzminski
date Sat, 27 Feb 2010 17:40:37 +0100
parents 1d3eba8c1012
children bbaab7501c1a
files hg_app hgapp.py manage-hg_app pylons_app/lib/hgapp.py
diffstat 4 files changed, 61 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/hg_app	Sat Feb 27 17:28:54 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/bin/sh -e
-### BEGIN INIT INFO
-# Provides:         pylons-manage          
-# Required-Start:    $all
-# Required-Stop:     $all
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: starts pylons app
-# Description:       starts pylons app
-### END INIT INFO
-
-project_name=hg_app
-conf_name=production.ini
-project_path=/home/marcink/python_workspace/$project_name
-virt_python=/home/marcink/virt_python
-
-cd $project_path
-case "$1" in
-  start)
-    $virt_python/bin/paster serve --daemon --pid-file=$project_path/$project_name.pid --log-file=$project_path/$project_name.log $project_path/$conf_name start
-    ;;
-  stop)
-    $virt_python/bin/paster serve --daemon --pid-file=$project_path/$project_name.pid --log-file=$project_path/$project_namete.log $project_path/$conf_name stop
-    ;;
-  restart)
-    $virt_python/bin/paster serve --daemon --pid-file=$project_path/$project_name.pid --log-file=$project_path/$project_name.log $project_path/$conf_name restart
-    ;;
-  *)
-    echo "Usage: $0 {start|stop|restart}"
-    exit 1
-esac
\ No newline at end of file
--- a/hgapp.py	Sat Feb 27 17:28:54 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-import logging
-from logging import Formatter, StreamHandler
-from wsgiref.simple_server import make_server
-from mercurial.hgweb.hgwebdir_mod import hgwebdir
-from mercurial.hgweb.request import wsgiapplication
-
-log = logging.getLogger(__name__)
-log.setLevel(logging.DEBUG)
-formatter = Formatter("%(asctime)s - %(levelname)s %(message)s")
-console_handler = StreamHandler()
-console_handler.setFormatter(formatter)
-log.addHandler(console_handler)
-
-def make_web_app():
-
-    repos = "hgwebdir.config"
-    hgwebapp = hgwebdir(repos)
-    return hgwebapp
-
-port = 8000
-ip = '127.0.0.1'
-
-log.info('Starting server on %s:%s' % (ip, port))
-httpd = make_server(ip, port, wsgiapplication(make_web_app))
-httpd.serve_forever()
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/manage-hg_app	Sat Feb 27 17:40:37 2010 +0100
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:         pylons-manage          
+# Required-Start:    $all
+# Required-Stop:     $all
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: starts pylons app
+# Description:       starts pylons app
+### END INIT INFO
+
+project_name=hg_app
+conf_name=production.ini
+project_path=/home/marcink/python_workspace/$project_name
+pid_path=$project_path
+log_path=$project_path
+virt_python=/home/marcink/virt_python
+run_user=root
+run_group=root
+
+cd $project_path
+case "$1" in
+  start)
+    $virt_python/bin/paster serve --daemon --user= $run_user --group=$run_group --pid-file=$pid_path/$project_name.pid --log-file=$log_path/$project_name.log $project_path/$conf_name start
+    ;;
+  stop)
+    $virt_python/bin/paster serve --daemon --user= $run_user --group=$run_group --pid-file=$pid_path/$project_name.pid --log-file=$log_path/$project_namete.log $project_path/$conf_name stop
+    ;;
+  restart)
+    $virt_python/bin/paster serve --daemon --user= $run_user --group=$run_group --pid-file=$pid_path/$project_name.pid --log-file=$log_path/$project_name.log $project_path/$conf_name restart
+    ;;
+  *)
+    echo "Usage: $0 {start|stop|restart}"
+    exit 1
+esac
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pylons_app/lib/hgapp.py	Sat Feb 27 17:40:37 2010 +0100
@@ -0,0 +1,26 @@
+import logging
+from logging import Formatter, StreamHandler
+from wsgiref.simple_server import make_server
+from mercurial.hgweb.hgwebdir_mod import hgwebdir
+from mercurial.hgweb.request import wsgiapplication
+
+log = logging.getLogger(__name__)
+log.setLevel(logging.DEBUG)
+formatter = Formatter("%(asctime)s - %(levelname)s %(message)s")
+console_handler = StreamHandler()
+console_handler.setFormatter(formatter)
+log.addHandler(console_handler)
+
+def make_web_app():
+
+    repos = "hgwebdir.config"
+    hgwebapp = hgwebdir(repos)
+    return hgwebapp
+
+port = 8000
+ip = '127.0.0.1'
+
+log.info('Starting server on %s:%s' % (ip, port))
+httpd = make_server(ip, port, wsgiapplication(make_web_app))
+httpd.serve_forever()
+