source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/handlers/fcgihandler.py @ 42095c5

mainqndtest v1.1.1
Last change on this file since 42095c5 was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 1.6 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5This file is part of the web2py Web Framework
6Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
7License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
8
9This is a handler for lighttpd+fastcgi
10This file has to be in the PYTHONPATH
11Put something like this in the lighttpd.conf file:
12
13server.port = 8000
14server.bind = '127.0.0.1'
15server.event-handler = 'freebsd-kqueue'
16server.modules = ('mod_rewrite', 'mod_fastcgi')
17server.error-handler-404 = '/test.fcgi'
18server.document-root = '/somewhere/web2py'
19server.errorlog      = '/tmp/error.log'
20fastcgi.server = ('.fcgi' =>
21                    ('localhost' =>
22                        ('min-procs' => 1,
23                         'socket'    => '/tmp/fcgi.sock'
24                        )
25                    )
26                 )
27"""
28
29LOGGING = False
30SOFTCRON = False
31
32import sys
33import os
34
35path = os.path.dirname(os.path.abspath(__file__))
36os.chdir(path)
37
38if not os.path.isdir('applications'):
39    raise RuntimeError('Running from the wrong folder')
40
41sys.path = [path] + [p for p in sys.path if not p == path]
42
43import gluon.main
44import gluon.contrib.gateways.fcgi as fcgi
45
46if LOGGING:
47    application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
48                                        logfilename='httpserver.log',
49                                        profiler_dir=None)
50else:
51    application = gluon.main.wsgibase
52
53if SOFTCRON:
54    from gluon.settings import global_settings
55    global_settings.web2py_crontype = 'soft'
56
57fcgi.WSGIServer(application, bindAddress='/tmp/fcgi.sock').run()
Note: See TracBrowser for help on using the repository browser.