1. Matthew J Little
  2. RhodeCode

Commits

Marcin Kuzminski  committed 5f30a6d

Added pylons manage script
fix the configs for zip archives
some other minot changes.

  • Participants
  • Parent commits 92b070b
  • Branches default

Comments (0)

Files changed (7)

File development.ini

View file
  • Ignore whitespace
-########################################################################
-##
-## pylons_app - Pylons development environment configuration
-##
-## The %(here)s variable will be replaced with the parent directory of this file
-##
-[exe]
-command = serve
-daemon = false
-user = nobody
-group = nobody
+################################################################################
+################################################################################
+# pylons_app - Pylons environment configuration                                #
+#                                                                              # 
+# The %(here)s variable will be replaced with the parent directory of this file#
+################################################################################
 
 [DEFAULT]
 debug = true
-## Uncomment and replace with the address which should receive any error reports
+############################################
+## Uncomment and replace with the address ##
+## which should receive any error reports ##
+############################################
 email_to = marcin.kuzminski@etelko.pl
 smtp_server = localhost
 error_email_from = paste_error@localhost
 [server:main]
 use = egg:Paste#http
 host = 127.0.0.1
-port = 8001
+port = 5000
 
 [app:main]
 use = egg:pylons_app
 full_stack = true
-static_files = false
-##default lang
+static_files = true
 lang=en
+cache_dir = %(here)s/data
 
-cache_dir = %(here)s/data
-beaker.session.key = pylons_app
-beaker.session.secret = #@^^F&VWUDCT%@$#WR^@&*IWEKF
-beaker.session.timeout = 3600
-
-##auto save the session to not to use .save()
-beaker.session.auto = True
-
-##true exire at browser close
-#beaker.session.cookie_expires = 3600
-
-## If you'd like to fine-tune the individual locations of the cache data dirs
-## for the Cache data, or the Session saves, un-comment the desired settings
-## here:
-#beaker.cache.data_dir = %(here)s/data/cache
-#beaker.session.data_dir = %(here)s/data/sessions
-
-
-##Type of storage used for the session, current types are 
-##“dbm”, “file”, “memcached”, “database”, and “memory”. 
-##The storage uses the Container API that is also used by the cache system.
-beaker.session.type = memory
-
-##if db or memcached is used
-##you have to use
-#beaker.session.url =
-#beaker.session.table_name =
-
-## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
-## Debug mode will enable the interactive debugging tool, allowing ANYONE to
-## execute malicious code after an exception is raised.
+################################################################################
+## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
+## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
+## execute malicious code after an exception is raised.                       ##
+################################################################################
 #set debug = false
 
-##dozer logging
-logview.pylons.templating = #bfb
-logview.sample_app.lib = #aaa
 
-# Logging configuration
+################################
+### LOGGING CONFIGURATION   ####
+################################
 [loggers]
-keys = root, routes, pylons_app
+keys = root, routes, pylons_app, sqlalchemy
 
 [handlers]
-keys = console,file_handler
+keys = console
 
 [formatters]
 keys = generic
 
+#############
 ## LOGGERS ##
+#############
 [logger_root]
-level = DEBUG
-handlers = console, file_handler
+level = INFO
+handlers = console
 
 [logger_routes]
-level = DEBUG
+level = INFO
 handlers = console
 qualname = routes.middleware
 # "level = DEBUG" logs the route matched and routing variables.
 
 [logger_pylons_app]
 level = DEBUG
-handlers = console,file_handler
+handlers = console
 qualname = pylons_app
 
+
+[logger_sqlalchemy]
+level = DEBUG
+handlers = console
+qualname = sqlalchemy.engine
+
+##############
 ## HANDLERS ##
+##############
 
 [handler_console]
 class = StreamHandler
 level = NOTSET
 formatter = generic
 
-[handler_file_handler]
-class = FileHandler
-args = ('./pylons_app.log','a')
-level = NOTSET
-formatter = generic
-
+################
 ## FORMATTERS ##
+################
 
 [formatter_generic]
 format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s

File hgwebdir.config

View file
  • Ignore whitespace
 contact = marcin.kuzminski@etelko.pl
 allow_archive = gz zip bz2
 allow_push = *
-#style = monoblue
 style = gitweb
-Spygments_style = trac
+pygments_style = trac
 staticurl = /static
 baseurl = /
 

File production.ini

View file
  • Ignore whitespace
-########################################################################
-##
-## pylons_app - Pylons development environment configuration
-##
-## The %(here)s variable will be replaced with the parent directory of this file
-##
-[exe]
-command = serve
-daemon = false
-user = nobody
-group = nobody
+################################################################################
+################################################################################
+# pylons_app - Pylons environment configuration                                #
+#                                                                              # 
+# The %(here)s variable will be replaced with the parent directory of this file#
+################################################################################
 
 [DEFAULT]
 debug = true
-## Uncomment and replace with the address which should receive any error reports
+############################################
+## Uncomment and replace with the address ##
+## which should receive any error reports ##
+############################################
 email_to = marcin.kuzminski@etelko.pl
 smtp_server = localhost
 error_email_from = paste_error@localhost
 
 [app:main]
 use = egg:pylons_app
-full_stack = true
-static_files = false
-##default lang
+full_stack = false
+static_files = true
+#default lang
 lang=en
 
 cache_dir = %(here)s/data
-beaker.session.key = pylons_app
-beaker.session.secret = #@^^F&VWUDCT%@$#WR^@&*IWEKF
-beaker.session.timeout = 3600
 
-##auto save the session to not to use .save()
-beaker.session.auto = True
 
-##true exire at browser close
-#beaker.session.cookie_expires = 3600
-
-## If you'd like to fine-tune the individual locations of the cache data dirs
-## for the Cache data, or the Session saves, un-comment the desired settings
-## here:
-#beaker.cache.data_dir = %(here)s/data/cache
-#beaker.session.data_dir = %(here)s/data/sessions
-
-
-##Type of storage used for the session, current types are 
-##“dbm”, “file”, “memcached”, “database”, and “memory”. 
-##The storage uses the Container API that is also used by the cache system.
-beaker.session.type = memory
-
-##if db or memcached is used
-##you have to use
-#beaker.session.url =
-#beaker.session.table_name =
-
-## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
-## Debug mode will enable the interactive debugging tool, allowing ANYONE to
-## execute malicious code after an exception is raised.
+################################################################################
+## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
+## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
+## execute malicious code after an exception is raised.                       ##
+################################################################################
 set debug = false
 
-##dozer logging
-#logview.sqlalchemy = #faa
-#logview.pylons.templating = #bfb
-#logview.sample_app.lib = #aaa
-
-# Logging configuration
+################################
+### LOGGING CONFIGURATION   ####
+################################
 [loggers]
-keys = root, routes, pylons_app
+keys = root, routes, pylons_app, sqlalchemy
 
 [handlers]
-keys = console,file_handler
+keys = console
 
 [formatters]
 keys = generic
 
+#############
 ## LOGGERS ##
+#############
 [logger_root]
-level = DEBUG
-handlers = file_handler
+level = INFO
+handlers = console
 
 [logger_routes]
 level = INFO
-handlers = file_handler
+handlers = console
 qualname = routes.middleware
 # "level = DEBUG" logs the route matched and routing variables.
 
 [logger_pylons_app]
 level = DEBUG
-handlers = file_handler
+handlers = console
 qualname = pylons_app
 
 
+[logger_sqlalchemy]
+level = DEBUG
+handlers = console
+qualname = sqlalchemy.engine
+
+##############
 ## HANDLERS ##
+##############
 
 [handler_console]
 class = StreamHandler
 level = NOTSET
 formatter = generic
 
-[handler_file_handler]
-class = FileHandler
-args = ('./pylons_app.log','a')
-level = NOTSET
-formatter = generic
-
+################
 ## FORMATTERS ##
+################
 
 [formatter_generic]
 format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s

File pylons-manage

View file
  • Ignore whitespace
+#!/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=development.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

File pylons_app/config/environment.py

View file
  • Ignore whitespace
 """Pylons environment configuration"""
 import logging
 import os
-from pylons import config
+
 from mako.lookup import TemplateLookup
 from pylons.error import handle_mako_error
+from pylons import config
+
 import pylons_app.lib.app_globals as app_globals
 import pylons_app.lib.helpers
 from pylons_app.config.routing import make_map
         directories = paths['templates'],
         error_handler = handle_mako_error,
         module_directory = os.path.join(app_conf['cache_dir'], 'templates'),
-        input_encoding = 'utf-8', default_filters = ['escape'],
-        imports = ['from webhelpers.html import escape'])
-
-    # Customize templating options via this variable
-    tmpl_options = config['buffet.template_options']
+        input_encoding = 'utf-8', output_encoding = 'utf-8',
+        imports = ['from webhelpers.html import escape'],
+        default_filters = ['escape'])
 
     # CONFIGURATION OPTIONS HERE (note: all config options will override
     # any Pylons config options)

File pylons_app/config/middleware.py

View file
  • Ignore whitespace
 from pylons.middleware import ErrorHandler, StatusCodeRedirect
 from pylons.wsgiapp import PylonsApp
 from routes.middleware import RoutesMiddleware
-
 from pylons_app.config.environment import load_environment
 
-def make_app(global_conf, full_stack = True, static_files = True, **app_conf):
+
+
+def make_app(global_conf, full_stack = True, **app_conf):
     """Create a Pylons WSGI application and return it
 
     ``global_conf``
         the [DEFAULT] section of the Paste ini file.
 
     ``full_stack``
-        Whether this application provides a full WSGI stack (by default,
-        meaning it handles its own exceptions and errors). Disable
-        full_stack when this application is "managed" by another WSGI
-        middleware.
-
-    ``static_files``
-        Whether this application serves its own static files; disable
-        when another web server is responsible for serving them.
+        Whether or not this application provides a full WSGI stack (by
+        default, meaning it handles its own exceptions and errors).
+        Disable full_stack when this application is "managed" by
+        another WSGI middleware.
 
     ``app_conf``
         The application's local configuration. Normally specified in
     # The Pylons WSGI app
     app = PylonsApp()
 
+    # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
+
     # Routing/Session/Cache Middleware
     app = RoutesMiddleware(app, config['routes.map'])
-    app = SessionMiddleware(app, config)
-    app = CacheMiddleware(app, config)
-
-    # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
 
     if asbool(full_stack):
         # Handle Python exceptions
     # Establish the Registry for this application
     app = RegistryManager(app)
 
-    if asbool(static_files):
-        # Serve static files
-        static_app = StaticURLParser(config['pylons.paths']['static_files'])
-        app = Cascade([static_app, app])
+    # Static files (If running in production, and Apache or another web
+    # server is handling this static content, remove the following 3 lines)
+    static_app = StaticURLParser(config['pylons.paths']['static_files'])
+    app = Cascade([static_app, app])
+    return app
 
-    #dozer debug
-    if asbool(config['debug']):
-        from dozer import Logview
-        app = Logview(app, config)
-
-    return app

File pylons_app/controllers/hg.py

View file
  • Ignore whitespace
         return g.hgapp(request.environ, self.start_response)
 
     def add_repo(self, new_repo):
-        tmpl = '''
+        tmpl = u'''
                   <html>
                     <body>
                         %(msg)s%(new_repo)s!<br \>
         return [tmpl % ({'new_repo':new_repo, 'msg':'added repo: '})]
 
     def _check_repo(self, repo_name):
-        p = os.path.dirname(__file__)
-        config_path = os.path.join(p, '../..', 'hgwebdir.config')
+        p = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+        config_path = os.path.join(p, 'hgwebdir.config')
 
         cp = ConfigParser()