Changeset 909:423e80aa13a9
- Timestamp:
- 01/06/09 03:43:23 (3 years ago)
- Branch:
- default
- Files:
-
- 7 edited
-
servers/README (modified) (1 diff)
-
servers/zine.cgi (modified) (3 diffs)
-
servers/zine.fcgi (modified) (2 diffs)
-
servers/zine.wsgi (modified) (3 diffs)
-
zine/__init__.py (modified) (1 diff)
-
zine/_core.py (modified) (2 diffs)
-
zine/application.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
servers/README
r465 r909 22 22 Just take the file of choice, copy it to where you want it to be and 23 23 adjust it. 24 25 All this files have some variables you can configure and invoke the 26 actual handler code. Variables written in uppercase are there for 27 you to change if you want. 28 29 Some of these can be set from the process environment as well (for 30 example via the apache `SetEnv` directive) if you prefix them with 31 ``ZINE_``. This works for the following keys: 32 33 `POOL_SIZE` 34 The size of the pool to be maintained. This is the largest number 35 of connections that will be kept persistently in the pool. Note 36 that the pool begins with no connections; once this number of 37 connections is requested, that number of connections will remain. 38 Defaults to 5. 39 If you are deploying Zine in a forking environment you want to set 40 this number to 1 or 2. 41 42 `POOL_RECYCLE` 43 If set to non -1, number of seconds between connection recycling, 44 which means upon checkout, if this timeout is surpassed the 45 connection will be closed and replaced with a newly opened 46 connection. Defaults to -1. 47 48 `POOL_TIMEOUT` 49 The number of seconds to wait before giving up on returning a 50 connection. Defaults to 30. 51 52 `BEHIND_PROXY` 53 If you are proxying into Zine somehow (caching proxies or external 54 fastcgi/http servers) set this value to True to enable proxy support. 55 Do not set this to True if you are not using proxies as this would 56 be a security risk. 57 If you specify this value from the process environment use the values 58 ``1`` and ``0`` instead of ``True`` and ``False``. -
servers/zine.cgi
r661 r909 6 6 7 7 Run Zine as CGI. Requires python 2.5 or python 2.4 with 8 the wsgiref module installed. 8 the wsgiref module installed. For help con configuration 9 have a look at the README file. 9 10 10 :copyright: 2008 by Armin Ronacher.11 :copyright: (c) 2009 by the Zine Team, see AUTHORS for more details. 11 12 :license: BSD, see LICENSE for more details. 12 13 """ … … 20 21 ZINE_LIB = '/usr/lib/zine' 21 22 23 # these values can be use to override database pool settings. 24 # see deployment guide for more details. 25 POOL_SIZE = None 26 POOL_RECYCLE = None 27 POOL_TIMEOUT = None 28 29 # if you are proxying into zine somehow (caching proxies or external 30 # fastcgi servers) set this value to True to enable proxy support. Do 31 # not set this to True if you are not using proxies as this would be a 32 # security risk. 33 BEHIND_PROXY = None 34 22 35 # enable this to enable an internal CGI debugging feature. 23 36 CGI_DEBUG = False 24 37 25 38 39 # ---------------------------------------------------------------------------- 26 40 # here you can further configure the wsgi app settings but usually you don't 27 41 # have to touch them … … 33 47 sys.path.insert(0, ZINE_LIB) 34 48 35 from zine import get_wsgi_app 49 from zine import get_wsgi_app, override_environ_config 36 50 from wsgiref.handlers import CGIHandler 51 override_environ_config(POOL_SIZE, POOL_RECYCLE, POOL_TIMEOUT, BEHIND_PROXY) 37 52 app = get_wsgi_app(INSTANCE_FOLDER) 38 53 -
servers/zine.fcgi
r688 r909 8 8 For working FastCGI support you have to have flup installed. 9 9 10 :copyright: 2008 by Armin Ronacher. 10 For help on configuration have a look at the README file. 11 12 :copyright: (c) 2009 by the Zine Team, see AUTHORS for more details. 11 13 :license: BSD, see LICENSE for more details. 12 14 """ … … 26 28 POOL_TIMEOUT = None 27 29 30 # if you are proxying into zine somehow (caching proxies or external 31 # fastcgi servers) set this value to True to enable proxy support. Do 32 # not set this to True if you are not using proxies as this would be a 33 # security risk. 34 BEHIND_PROXY = None 35 28 36 # ---------------------------------------------------------------------------- 29 37 # here you can further configure the fastcgi and wsgi app settings 30 38 # but usually you don't have to touch them. 31 39 import sys 32 import os33 34 40 sys.path.insert(0, ZINE_LIB) 35 41 36 for key in 'POOL_SIZE', 'POOL_RECYCLE', 'POOL_TIMEOUT': 37 value = locals().get(key) 38 if value is not None: 39 os.environ['ZINE_DATABASE_' + key] = value 40 41 from zine import get_wsgi_app 42 from zine import get_wsgi_app, override_environ_config 42 43 from flup.server.fcgi import WSGIServer 44 override_environ_config(POOL_SIZE, POOL_RECYCLE, POOL_TIMEOUT, BEHIND_PROXY) 43 45 app = get_wsgi_app(INSTANCE_FOLDER) 44 46 srv = WSGIServer(app) -
servers/zine.wsgi
r688 r909 2 2 """ 3 3 Zine mod_wsgi Runner 4 ~~~~~~~~~~~~~~~~~~~~ ~~~~~4 ~~~~~~~~~~~~~~~~~~~~ 5 5 6 Run Zine in mod_wsgi. 6 Run Zine in mod_wsgi. For help on configuration have a look at the 7 README file. 7 8 8 :copyright: 2008 by Armin Ronacher.9 :copyright: (c) 2009 by the Zine Team, see AUTHORS for more details. 9 10 :license: BSD, see LICENSE for more details. 10 11 """ … … 24 25 POOL_TIMEOUT = None 25 26 27 # if you are proxying into zine somehow (caching proxies or external 28 # fastcgi servers) set this value to True to enable proxy support. Do 29 # not set this to True if you are not using proxies as this would be a 30 # security risk. 31 BEHIND_PROXY = None 32 33 # ---------------------------------------------------------------------------- 26 34 # here you can further configure the wsgi app settings but usually you don't 27 35 # have to touch them … … 31 39 sys.path.insert(0, ZINE_LIB) 32 40 33 for key in 'POOL_SIZE', 'POOL_RECYCLE', 'POOL_TIMEOUT': 34 value = locals().get(key) 35 if value is not None: 36 os.environ['ZINE_DATABASE_' + key] = value 37 38 from zine import get_wsgi_app 41 from zine import get_wsgi_app, override_environ_config 42 from flup.server.fcgi import WSGIServer 43 override_environ_config(POOL_SIZE, POOL_RECYCLE, POOL_TIMEOUT, BEHIND_PROXY) 39 44 application = get_wsgi_app(INSTANCE_FOLDER) -
zine/__init__.py
r873 r909 34 34 # the core module is *not* reloaded, thus stuff will get lost if it's not 35 35 # properly listed. 36 from zine._core import setup, get_wsgi_app 37 __all__ = ('setup', 'get_wsgi_app' )36 from zine._core import setup, get_wsgi_app, override_environ_config 37 __all__ = ('setup', 'get_wsgi_app', 'override_environ_config') -
zine/_core.py
r873 r909 10 10 """ 11 11 12 import os 12 13 from thread import allocate_lock 13 14 from time import time, sleep … … 141 142 return app(environ, start_response) 142 143 return application 144 145 146 def override_environ_config(pool_size=None, pool_recycle=None, 147 pool_timeout=None, behind_proxy=None): 148 """Some configuration parameters are not stored in the zine.ini but 149 in the os environment. These are process wide configuration settings 150 used for different deployments. 151 """ 152 for key, value in locals().items(): 153 if value is not None: 154 if key == 'behind_proxy': 155 value = int(bool(value)) 156 os.environ['ZINE_' + key.upper()] = str(value) -
zine/application.py
r889 r909 11 11 :license: BSD, see LICENSE for more details. 12 12 """ 13 from os import path, remove, makedirs, walk 13 from os import path, remove, makedirs, walk, environ 14 14 from time import time 15 15 from itertools import izip … … 232 232 """This class holds the incoming request data.""" 233 233 234 234 235 def __init__(self, environ, app=None): 235 236 RequestBase.__init__(self, environ) … … 255 256 self.user = user 256 257 self.session = session 258 259 @property 260 def is_behind_proxy(self): 261 """Are we behind a proxy?""" 262 return environ.get('ZINE_BEHIND_PROXY') == '1' 257 263 258 264 def login(self, user, permanent=False):
Note: See TracChangeset
for help on using the changeset viewer.