- paster serve --reload production.ini
- Starting subprocess with file monitor
- Traceback (most recent call last):
- File "/usr/bin/paster", line 9, in <module>
- load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
- File "/usr/lib/python2.6/site-packages/paste/script/command.py", line 84, in run
- invoke(command, command_name, options, args[1:])
- File "/usr/lib/python2.6/site-packages/paste/script/command.py", line 123, in invoke
- exit_code = runner.run(args)
- File "/usr/lib/python2.6/site-packages/paste/script/command.py", line 218, in run
- result = self.command()
- File "/usr/lib/python2.6/site-packages/paste/script/serve.py", line 276, in command
- relative_to=base, global_conf=vars)
- File "/usr/lib/python2.6/site-packages/paste/script/serve.py", line 313, in loadapp
- **kw)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 204, in loadapp
- return loadobj(APP, uri, name=name, **kw)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 224, in loadobj
- global_conf=global_conf)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 248, in loadcontext
- global_conf=global_conf)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 278, in _loadconfig
- return loader.get_context(object_type, name, global_conf)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 409, in get_context
- section)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 431, in _context_from_use
- object_type, name=use, global_conf=global_conf)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 361, in get_context
- global_conf=global_conf)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 248, in loadcontext
- global_conf=global_conf)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 285, in _loadegg
- return loader.get_context(object_type, name, global_conf)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 561, in get_context
- object_type, name=name)
- File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 587, in find_egg_entry_point
- possible.append((entry.load(), protocol, entry.name))
- File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
- entry = __import__(self.module_name, globals(),globals(), ['__name__'])
- File "/var/www/management/config/middleware.py", line 8, in <module>
- from pylons.error import error_template
- ImportError: cannot import name error_template
- And Python and Pylons version:
- Python 2.6.6 (r266:84292, May 1 2012, 13:52:17)
- [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import pylons
- >>> pylons
- <module 'pylons' from '/usr/lib/python2.6/site-packages/Pylons-1.0-py2.6.egg/pylons/__init__.pyc'>
- The middleware.py file in /var/www/management/config/middleware.py:
- """Pylons middleware initialization"""
- from paste.cascade import Cascade
- from paste.registry import RegistryManager
- from paste.urlparser import StaticURLParser
- from paste.deploy.converters import asbool
- from pylons import config
- from pylons.error import error_template
- from pylons.middleware import error_mapper, ErrorDocuments, ErrorHandler, \
- StaticJavascripts
- from pylons.wsgiapp import PylonsApp
- from svnadmin.config.environment import load_environment
- def make_app(global_conf, full_stack=True, **app_conf):
- """Create a Pylons WSGI application and return it
- ``global_conf``
- The inherited configuration for this application. Normally from
- the [DEFAULT] section of the Paste ini file.
- ``full_stack``
- 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
- [app:<name>] section of the Paste ini file (where <name>
- defaults to main).
- """
- # Configure the Pylons environment
- load_environment(global_conf, app_conf)
- # The Pylons WSGI app
- app = PylonsApp()
- # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
- if asbool(full_stack):
- # Handle Python exceptions
- app = ErrorHandler(app, global_conf, error_template=error_template,
- **config['pylons.errorware'])
- # Display error documents for 401, 403, 404 status codes (and
- # 500 when debug is disabled)
- app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)
- # Establish the Registry for this application
- app = RegistryManager(app)
- # Static files
- javascripts_app = StaticJavascripts()
- static_app = StaticURLParser(config['pylons.paths']['static_files'])
- app = Cascade([static_app, javascripts_app, app])
- return app