| 1 | #!/usr/bin/python |
|---|
| 2 | # -*- coding: utf-8 -*- |
|---|
| 3 | """ |
|---|
| 4 | Zine CGI Runner |
|---|
| 5 | ~~~~~~~~~~~~~~~ |
|---|
| 6 | |
|---|
| 7 | Run Zine as CGI. Requires python 2.5 with |
|---|
| 8 | the wsgiref module installed. For help con configuration |
|---|
| 9 | have a look at the README file. |
|---|
| 10 | |
|---|
| 11 | :copyright: (c) 2010 by the Zine Team, see AUTHORS for more details. |
|---|
| 12 | :license: BSD, see LICENSE for more details. |
|---|
| 13 | """ |
|---|
| 14 | |
|---|
| 15 | # path to the instance. the folder for the instance must exist, |
|---|
| 16 | # if there is not instance information in that folder the websetup |
|---|
| 17 | # will show an assistent |
|---|
| 18 | INSTANCE_FOLDER = '/path/to/instance/folder' |
|---|
| 19 | |
|---|
| 20 | # path to the Zine application code. |
|---|
| 21 | ZINE_LIB = '/usr/lib/zine' |
|---|
| 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 | |
|---|
| 35 | # enable this to enable an internal CGI debugging feature. |
|---|
| 36 | CGI_DEBUG = False |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | # ---------------------------------------------------------------------------- |
|---|
| 40 | # here you can further configure the wsgi app settings but usually you don't |
|---|
| 41 | # have to touch them |
|---|
| 42 | if CGI_DEBUG: |
|---|
| 43 | import cgitb |
|---|
| 44 | cgitb.enable() |
|---|
| 45 | |
|---|
| 46 | import sys |
|---|
| 47 | sys.path.insert(0, ZINE_LIB) |
|---|
| 48 | |
|---|
| 49 | from zine import get_wsgi_app, override_environ_config |
|---|
| 50 | from wsgiref.handlers import CGIHandler |
|---|
| 51 | override_environ_config(POOL_SIZE, POOL_RECYCLE, POOL_TIMEOUT, BEHIND_PROXY) |
|---|
| 52 | app = get_wsgi_app(INSTANCE_FOLDER) |
|---|
| 53 | |
|---|
| 54 | if __name__ == '__main__': |
|---|
| 55 | CGIHandler().run(app) |
|---|