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 | """ |
---|
5 | This file is part of the web2py Web Framework |
---|
6 | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> |
---|
7 | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) |
---|
8 | |
---|
9 | This is a CGI handler for Apache |
---|
10 | Requires apache+[mod_cgi or mod_cgid]. |
---|
11 | |
---|
12 | In httpd.conf put something like: |
---|
13 | |
---|
14 | LoadModule cgi_module modules/mod_cgi.so |
---|
15 | ScriptAlias / /path/to/cgihandler.py/ |
---|
16 | |
---|
17 | Example 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 | |
---|
53 | import os |
---|
54 | import sys |
---|
55 | import wsgiref.handlers |
---|
56 | |
---|
57 | path = os.path.dirname(os.path.abspath(__file__)) |
---|
58 | os.chdir(path) |
---|
59 | |
---|
60 | if not os.path.isdir('applications'): |
---|
61 | raise RuntimeError('Running from the wrong folder') |
---|
62 | |
---|
63 | sys.path = [path] + [p for p in sys.path if not p == path] |
---|
64 | |
---|
65 | import gluon.main |
---|
66 | |
---|
67 | wsgiref.handlers.CGIHandler().run(gluon.main.wsgibase) |
---|
Note: See
TracBrowser
for help on using the repository browser.