Project

General

Profile

Revision c541cd24

IDc541cd24dcc18a14058f982176fbb8d55eaaf72c
Parent 7b81cb66
Child 0dbc20a0

Added by Thomas ANDREJAK almost 15 years ago

Suppression des dossiers à ne pas versionner

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@328 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

apache/README.txt
1
#Here is a numbered list of what you need to do to deploy you Turbogears2 or Pylons application. Follow 1 through 6. 
2

  
3
#1. Create production.ini configuration file if its not there already. Example: 
4
cp development.ini production.ini
5
#Edit production.ini and delete the port settings or make sure its set to 80.
6

  
7
#2. Change or check the apache settings file.
8
#Edit /usr/local/turbogears/vigiboard/apache/vigiboard and make sure it has the necessary apache configurations you need.
9
#Copy {vigiboard} apache config file to apache folder. Example:
10
cp /usr/local/turbogears/vigiboard/apache/vigiboard /etc/apache2/sites-available/vigiboard
11

  
12
#3.Check if permissions are the same as other apache sites usually (root:root)
13

  
14
ls -l /etc/apache2/sites-available/
15
#You shoud see
16
#total 16
17
#-rw-r--r-- 1 root root  950 2008-08-08 13:06 default
18
#-rw-r--r-- 1 root root 7366 2008-08-08 13:06 default-ssl
19
#-rw-r--r-- 1 root root 1077 2008-11-08 12:38 vigiboard
20

  
21
#4.Enable your site.
22
a2ensite vigiboard
23

  
24
#5. Check if your project has proper permissions, usually apache user. (Example: www-data:www-data on Debian).
25
ls -l /usr/local/turbogears/vigiboard/apache/
26
#total 16
27
#-rw-r--r-- 1 www-data www-data 1077 2008-11-26 22:35 vigiboard
28
#-rw-r--r-- 1 www-data www-data 2319 2008-11-26 23:25 vigiboard.wsgi
29
#-rw-r--r-- 1 www-data www-data  594 2008-11-26 22:35 README.txt
30
#-rw-r--r-- 1 www-data www-data  538 2008-11-26 22:35 test.wsgi
31

  
32
#6.Reload apache
33
/etc/init.d/apache2 reload
34

  
35

  
36
#You are done. Your application should be working. Check the access.log, warn.log, and error.log in /var/log/apache to see if there are any errors. 
apache/test.wsgi
1
#Test modwsgi.
2
#Hello world test application to make sure modwsgi runs. Link from you apache file to here to test.
3

  
4
def application(environ, start_response):
5
    status = '200 OK'
6
    output = 'Hello World!'
7
    #print >> sys.stderr, "sys.stderr"
8
    #print >> environ["wsgi.errors"], "wsgi.errors" 
9
    response_headers = [('Content-type', 'text/plain'),
10
                        ('Content-Length', str(len(output)))]
11
    start_response(status, response_headers)
12

  
13
    return [output]
14

  
15

  
apache/vigiboard
1
#Apache configuration File
2
#Read README.txt
3
#1. This file should be added to your apache config folder; On Debian copy to /etc/apache2/sites-available/
4
#Default location for tg2 project is /usr/local/turbogears/vigiboard. That is where you should put your project. This folder should be outside of apache location. Your package should not be installed into python site-package.
5

  
6
#2. Alias/Allow apache to serve static content.
7
Alias /vigiboard/images /usr/local/turbogears/vigiboard/vigiboard/public/images
8
Alias /vigiboard/css /usr/local/turbogears/vigiboard/vigiboard/public/css
9
Alias /vigiboard/javascript /usr/local/turbogears/vigiboard/vigiboard/public/javascript
10

  
11
#Embeded mode (http://example.com/vigiboard).For big websites with a lot of memory and visitors.
12
WSGIScriptAlias /vigiboard /usr/local/turbogears/vigiboard/apache/vigiboard.wsgi
13

  
14
#3. Test if modwsgi is working. Uncomment below line, and go to http://localhost/test:
15
#WSGIScriptAlias /test /usr/local/turbogears/vigiboard/apache/test.wsgi
16

  
17
#4. [Optional] Sitewide (http://example.com/)
18
#Alias /images /usr/local/turbogears/vigiboard/vigiboard/public/images
19
#Alias /css /usr/local/turbogears/vigiboard/vigiboard/public/css
20
#Alias /javascript /usr/local/turbogears/vigiboard/vigiboard/public/javascript
21
#WSGIScriptAlias / /usr/local/turbogears/apache/vigiboard.wsgi
22

  
23
#5. [Optional] Deamon mode with 10 threads and 3 processes. For small to medium website.
24
#WSGIDaemonProcess vigiboard threads=10 processes=3
25
#WSGIProcessGroup vigiboard
26
#WSGIScriptAlias / /usr/local/turbogears/vigiboard/apache/vigiboard.wsgi
27

  
28
#6. Directory Permission.
29
<Directory /usr/local/turbogears/vigiboard/apache>
30
Order deny,allow
31
Allow from all
32
</Directory>
33

  
34
#7. [Optional] If you want to use Virtualhost apache settings. 
35
#Sample Virtual Host configuration would look like this:
36

  
37
<Directory /usr/local/turbogears/vigiboard/vigiboard/public>
38
    Order allow,deny
39
    Allow from all
40
</Directory>
41

  
42
#NameVirtualHost *:81
43
#<VirtualHost *:81>
44
#    WSGIScriptAlias / /usr/local/turbogears/vigiboard/apache/vigiboard.wsgi
45
#</VirtualHost>
apache/vigiboard.wsgi
1
#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
sys.stdout = sys.stderr
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/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
52
import paste.fixture
53
app = paste.fixture.TestApp(application)
54
app.get("/")

Also available in: Unified diff