vigiboard / apache / vigiboard.wsgi @ 35cea70e
History | View | Annotate | Download (1.89 KB)
1 | 49c8da1d | Thomas ANDREJAK | #modwsgi script for vigiboard |
---|---|---|---|
2 | |||
3 | #1.Point to this script in you apache config file. |
||
4 | #Default location for all apps is: |
||
5 | #Debian: /usr/local/turbogears/vigiboard |
||
6 | |||
7 | #2. Make sure apache user own the folder. |
||
8 | #Debian: chown -R www-data:www-data /usr/local/turbogears/vigiboard |
||
9 | |||
10 | import sys |
||
11 | |||
12 | #3. start of virtualenv (enabled by default). |
||
13 | #Please comment out until 4 if you don't use virtualenv. |
||
14 | #Make sure root owns the virtualenv folder. Example:(root:root) |
||
15 | #Create virtualenv if you didn't create it yet: |
||
16 | #mkdir /usr/local/pythonenv |
||
17 | #virtualenv --no-site-packages /usr/local/pythonenv/BASELINE |
||
18 | |||
19 | prev_sys_path = list(sys.path) |
||
20 | |||
21 | import site |
||
22 | site.addsitedir('/usr/local/pythonenv/BASELINE/lib/python2.5/site-packages') |
||
23 | |||
24 | #Move just added item to the front of the python system path. |
||
25 | #Not needed if modwsgi>=3.0. Uncomment next 6 lines. |
||
26 | new_sys_path = [] |
||
27 | for item in list(sys.path): |
||
28 | if item not in prev_sys_path: |
||
29 | new_sys_path.append(item) |
||
30 | sys.path.remove(item) |
||
31 | sys.path[:0] = new_sys_path |
||
32 | |||
33 | #End of virtualenv |
||
34 | |||
35 | #4. Your website file location. |
||
36 | import os, sys |
||
37 | sys.path.append('/usr/local/turbogears/vigiboard') |
||
38 | |||
39 | #5. Set the environment variable PYTHON_EGG_CACHE to an appropriate directory where the Apache user has write permission and into which it can unpack egg files. |
||
40 | os.environ['PYTHON_EGG_CACHE'] = '/usr/local/turbogears/vigiboard/python-eggs' |
||
41 | |||
42 | #6.[Optional]If you want to enable logging you need to initialize logging. You also need to setup logger handlers in you production.ini. When done uncomment next two lines. |
||
43 | #from paste.script.util.logging_config import fileConfig |
||
44 | #fileConfig('/usr/local/turbogears/vigiboard/production.ini') |
||
45 | |||
46 | #7. Load you application production.ini file. |
||
47 | from paste.deploy import loadapp |
||
48 | application = loadapp('config:/usr/local/turbogears/vigiboard/production.ini') |
||
49 | |||
50 | |||
51 | #8.[Optional] If you want to test modwsgi only, uncomment section 3 in you /usr/local/turbogears/vigiboard/apache/vigiboard |