source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/handlers/cgihandler.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.5 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 CGI handler for Apache
10Requires apache+[mod_cgi or mod_cgid].
11
12In httpd.conf put something like:
13
14    LoadModule cgi_module modules/mod_cgi.so
15    ScriptAlias / /path/to/cgihandler.py/
16
17Example of httpd.conf ------------
18<VirtualHost *:80>
19  ServerName web2py.example.com
20  ScriptAlias / /users/www-data/web2py/cgihandler.py/
21
22  <Directory /users/www-data/web2py>
23    AllowOverride None
24    Order Allow,Deny
25    Deny from all
26    <Files cgihandler.py>
27      Allow from all
28    </Files>
29  </Directory>
30
31  AliasMatch ^/([^/]+)/static/(.*) \
32           /users/www-data/web2py/applications/$1/static/$2
33  <Directory /users/www-data/web2py/applications/*/static/>
34    Order Allow,Deny
35    Allow from all
36  </Directory>
37
38  <Location /admin>
39  Deny from all
40  </Location>
41
42  <LocationMatch ^/([^/]+)/appadmin>
43  Deny from all
44  </LocationMatch>
45
46  CustomLog /private/var/log/apache2/access.log common
47  ErrorLog /private/var/log/apache2/error.log
48</VirtualHost>
49----------------------------------
50
51"""
52
53import os
54import sys
55import wsgiref.handlers
56
57path = os.path.dirname(os.path.abspath(__file__))
58os.chdir(path)
59
60if not os.path.isdir('applications'):
61    raise RuntimeError('Running from the wrong folder')
62
63sys.path = [path] + [p for p in sys.path if not p == path]
64
65import gluon.main
66
67wsgiref.handlers.CGIHandler().run(gluon.main.wsgibase)
Note: See TracBrowser for help on using the repository browser.