Merge lp:~mcfletch/modwsgideploy/parameterized into lp:~szybalski/modwsgideploy/trunk

Proposed by Mike C. Fletcher
Status: Needs review
Proposed branch: lp:~mcfletch/modwsgideploy/parameterized
Merge into: lp:~szybalski/modwsgideploy/trunk
Diff against target: 671 lines (+346/-179)
7 files modified
trunk/README.txt (+6/-6)
trunk/modwsgideploy.egg-info/PKG-INFO (+1/-1)
trunk/modwsgideploy.egg-info/entry_points.txt (+1/-1)
trunk/modwsgideploy/commands.py (+150/-55)
trunk/modwsgideploy/templates/apache/+package+.wsgi_tmpl (+74/-36)
trunk/modwsgideploy/templates/apache/+package+_tmpl (+64/-43)
trunk/modwsgideploy/templates/apache/README.txt_tmpl (+50/-37)
To merge this branch: bzr merge lp:~mcfletch/modwsgideploy/parameterized

Description of the change

Hi Lucas,

I've made a few changes and enhancements to the modwsgi_deploy script:

* parameterized almost all paths, names and the like
* updated for use with any Python 2.x interpreter
* tried to compress the code using conditionals
* numerous typo fixes
* cleaned out some copy-and-paste code that wasn't getting used
* generate warnings if referenced paths don't exist with instructions on how to fix
* reformatted the .wsgi file to look more like a Python module

I haven't finished testing, just wanted to give you a heads-up so you could look over the changes and see whether you're interested in integrating them.

Enjoy,
Mike

To post a comment you must log in.

Unmerged revisions

21. By Mike C. Fletcher

Testing of default operation on Apache shows we're getting close.
python-eggs test/warning on configuration

20. By Mike C. Fletcher

Even more parameterization.
Log warnings to the user about not-yet-finished operations in the setup.
Fix missing application virtualenv option.
Make the apache template slightly more compact.
Rewrite readme as (loosely) .rst format.

19. By Mike C. Fletcher

Yet more parameterization.
Clean up the generated .wsgi file to look a little more like a Python file, with a docstring, wrapped lines, only the configured pieces, etceteras

18. By Mike C. Fletcher

Cleanup usage string to eliminate old copy-and-pasted descriptions that no longer apply.
Make deployment and baseline directories command-line configurable
Make logging setup configurable from the command line.
Use the current Python version as the default for the lib/.../ links, allow command-line override.

17. By Mike C. Fletcher

Minor typo fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'trunk/README.txt'
--- trunk/README.txt 2009-09-27 03:29:25 +0000
+++ trunk/README.txt 2010-03-08 17:56:30 +0000
@@ -34,7 +34,7 @@
34 cd modwsgideploy_code/trunk34 cd modwsgideploy_code/trunk
35 python setup.py develop35 python setup.py develop
3636
37Run modwsgi_deploy 37Run modwsgi_deploy
38------------------38------------------
3939
40Go into your python application project folder and type in::40Go into your python application project folder and type in::
@@ -45,7 +45,7 @@
45Example45Example
46-------46-------
4747
48Here is a typical installation, from start to finish on Debian Linux. You might have to use you OS specific commands for installing apache. 48Here is a typical installation, from start to finish on Debian Linux. You might have to use you OS specific commands for installing apache.
4949
50The steps are:50The steps are:
511) Install apache and modwsgi511) Install apache and modwsgi
@@ -62,7 +62,7 @@
62 source BASELINE/bin/activate62 source BASELINE/bin/activate
63 easy_install -i http://www.turbogears.org/2.0/downloads/current/index tg.devtools63 easy_install -i http://www.turbogears.org/2.0/downloads/current/index tg.devtools
64 paster quickstart myapp64 paster quickstart myapp
65 65
66Install modwsgideploy::66Install modwsgideploy::
6767
68 easy_install modwsgideploy68 easy_install modwsgideploy
@@ -80,14 +80,14 @@
80 | |-- myapp80 | |-- myapp
81 | |-- myapp.wsgi81 | |-- myapp.wsgi
82 | `-- test.wsgi82 | `-- test.wsgi
83 83
8484
851. Read the README.txt851. Read the README.txt
862. myapp is a apache configuration file that you need to copy into your apache configuration folder after all the settings are set.862. myapp is a apache configuration file that you need to copy into your apache configuration folder after all the settings are set.
873. myapp.wsgi is an modwsgi script that is called from myapp apache file873. myapp.wsgi is an modwsgi script that is called from myapp apache file
884. test.wsgi is a test script that you can call to see if you modwsgi was properly installed and working.884. test.wsgi is a test script that you can call to see if you modwsgi was properly installed and working.
8989
90Edit myapp file to change any paths and/or apache configurations. Then copy to apache folder. 90Edit myapp file to change any paths and/or apache configurations. Then copy to apache folder.
9191
92On my operating system I copy this file to::92On my operating system I copy this file to::
9393
@@ -103,5 +103,5 @@
103Feedback103Feedback
104--------104--------
105105
106If you have a useful sample wsgi script or apache config that you would like to share, please sent it to Turbogears mailing list. 106If you have a useful sample wsgi script or apache config that you would like to share, please send it to Turbogears mailing list.
107107
108108
=== modified file 'trunk/modwsgideploy.egg-info/PKG-INFO'
--- trunk/modwsgideploy.egg-info/PKG-INFO 2009-09-27 03:58:24 +0000
+++ trunk/modwsgideploy.egg-info/PKG-INFO 2010-03-08 17:56:30 +0000
@@ -1,6 +1,6 @@
1Metadata-Version: 1.01Metadata-Version: 1.0
2Name: modwsgideploy2Name: modwsgideploy
3Version: 0.4.18dev3Version: 0.4.20dev
4Summary: Deploy Turbogears2 or Pylons via apache and modwsgi.4Summary: Deploy Turbogears2 or Pylons via apache and modwsgi.
5Home-page: http://lucasmanual.com/mywiki/modwsgideploy5Home-page: http://lucasmanual.com/mywiki/modwsgideploy
6Author: Lukasz Szybalski6Author: Lukasz Szybalski
77
=== modified file 'trunk/modwsgideploy.egg-info/entry_points.txt'
--- trunk/modwsgideploy.egg-info/entry_points.txt 2009-04-10 20:17:26 +0000
+++ trunk/modwsgideploy.egg-info/entry_points.txt 2010-03-08 17:56:30 +0000
@@ -1,4 +1,4 @@
11
2 [paste.global_paster_command]2 [paste.global_paster_command]
3 modwsgi_deploy = modwsgideploy.commands:ModwsgiCommand3 modwsgi_deploy = modwsgideploy.commands:ModwsgiCommand
4
5\ No newline at end of file4\ No newline at end of file
5
6\ No newline at end of file6\ No newline at end of file
77
=== modified file 'trunk/modwsgideploy/commands.py'
--- trunk/modwsgideploy/commands.py 2008-12-16 04:47:54 +0000
+++ trunk/modwsgideploy/commands.py 2010-03-08 17:56:30 +0000
@@ -7,48 +7,16 @@
77
8 modwsgi_deploy8 modwsgi_deploy
9"""9"""
10
11import os10import os
12import sys11import sys
1312import logging, pprint
13log = logging.getLogger( 'modwsgideploy' )
14from paste.script.command import Command, BadCommand14from paste.script.command import Command, BadCommand
15from paste.script.filemaker import FileOp15from paste.script.filemaker import FileOp
16from paste.script.copydir import copy_dir16from paste.script.copydir import copy_dir
17
18
19#Needed to manipulate egg information17#Needed to manipulate egg information
20from paste.script import pluginlib18from paste.script import pluginlib
2119
22def can_import(name):
23 """Attempt to __import__ the specified package/module, returning True when
24 succeeding, otherwise False"""
25 try:
26 __import__(name)
27 return True
28 except ImportError:
29 return False
30
31def validateName(name):
32 """Validate that the name for the layer isn't present on the
33 path already"""
34 if not name:
35 # This happens when the name is an existing directory
36 raise BadCommand('Please give the name of a layer.')
37 # 'setup' is a valid controller name, but when paster controller is ran
38 # from the root directory of a project, importing setup will import the
39 # project's setup.py causing a sys.exit(). Blame relative imports
40 if name != 'setup' and can_import(name):
41 raise BadCommand(
42 "\n\nA module named '%s' is already present in your "
43 "PYTHON_PATH.\nChoosing a conflicting name will likely cause "
44 "import problems in\nyour controller at some point. It's "
45 "suggested that you choose an\nalternate name, and if you'd "
46 "like that name to be accessible as\n'%s', add a route "
47 "to your projects config/routing.py file similar\nto:\n"
48 " map.connect('%s', controller='my_%s')" \
49 % (name, name, name, name))
50 return True
51
52class ModwsgiCommand(Command):20class ModwsgiCommand(Command):
53 """Create a modwsgi apache configuration.21 """Create a modwsgi apache configuration.
5422
@@ -57,17 +25,10 @@
57 Example usage::25 Example usage::
5826
59 yourproj% paster modwsgi_deploy27 yourproj% paster modwsgi_deploy
60 Creating yourproj/yourproj/controllers/foos.py28
61 Creating yourproj/yourproj/tests/functional/test_foos.py29 Or, with logging enabled:
6230
63 If you'd like to have controllers underneath a directory, just include31 yourproj% paster modwsgi_deploy --logging
64 the path as the controller name and the necessary directories will be
65 created for you::
66
67 yourproj% paster geo-controller admin/foos
68 Creating yourproj/controllers/admin
69 Creating yourproj/yourproj/controllers/admin/foos.py
70 Creating yourproj/yourproj/tests/functional/test_admin_foos.py
71 """32 """
72 summary = __doc__.splitlines()[0]33 summary = __doc__.splitlines()[0]
73 usage = '\n' + __doc__34 usage = '\n' + __doc__
@@ -79,17 +40,58 @@
79 default_verbosity = 340 default_verbosity = 3
8041
81 parser = Command.standard_parser(simulate=True)42 parser = Command.standard_parser(simulate=True)
82 parser.add_option('--no-test',
83 action='store_true',
84 dest='no_test',
85 help="Don't create the test; just the controller")
86 parser.add_option('-o', '--output-dir',43 parser.add_option('-o', '--output-dir',
87 dest='output_dir',44 dest='output_dir',
88 metavar='DIR',45 metavar='DIR',
89 default='.',46 default='.',
90 help="Write put the directory into DIR (default current directory)")47 help="Write Apache2 configuration files in DIR/apache (default current directory)")
48 parser.add_option('-b', '--baseline',
49 dest='baseline',
50 metavar='DIR',
51 default='/usr/local/pythonenv/BASELINE',
52 help="Path to the BASELINE VirtualEnv shared by applications, if set to '', then no BASELINE VirtualEnv is configured")
53 parser.add_option('-e', '--virtualenv',
54 dest='virtualenv',
55 action='store',
56 default=os.pathsep,
57 help="Path to the application's VirtualEnv, if explicitly set to '', use system python, if not specified, use directory <package_name> next to BASELINE")
58 parser.add_option('-d', '--deployment',
59 dest='deployment',
60 metavar='DIR',
61 default='/usr/local/turbogears',
62 help="Path where applications are installed, your app will be ${deployment}/package_name")
63 parser.add_option('-c', '--config',
64 dest='config',
65 action="store",
66 default = 'production.ini',
67 help="Name of the TurboGears2 configuration file (default production.ini)")
68 parser.add_option('-p', '--python',
69 dest='python_version',
70 default='python%s.%s'%( sys.version_info[:2] ),
71 help="Python version for the deployment")
72 parser.add_option('-l', '--logging',
73 dest='logging',
74 action="store_true",
75 default=False,
76 help="Whether to enable logging for the config (default False)")
77 parser.add_option('-m', '--subsite',
78 dest='mount',
79 action="store",
80 default = '',
81 help="URL sub-path at which to mount the application default (/package or '/' if virtualhost specified), use '/' to mount as the root of the site")
82 parser.add_option('-H', '--virtualhost',
83 dest='vhost',
84 action="store",
85 default = '',
86 help="Virtual Host (Domain Name) to use for this configuration, such as 'myvirtual.mydomain.com', default is not to use a VirtualHost")
87 parser.add_option('-E', '--embedded-mode',
88 dest='embedded',
89 action='store_true',
90 default=False,
91 help="Use mod_wsgi embedded mode (only recommended on Win32)")
91 def command(self):92 def command(self):
92 """Main command to create a modwsgi configuration files"""93 """Main command to create a modwsgi configuration files"""
94 logging.basicConfig(level=logging.INFO)
93 #Output directory is current folder unless specified vi output command.95 #Output directory is current folder unless specified vi output command.
94 output_dir = os.path.join(self.options.output_dir, 'apache')96 output_dir = os.path.join(self.options.output_dir, 'apache')
95 #Input where the templates are at.97 #Input where the templates are at.
@@ -110,12 +112,105 @@
110 #Add package names112 #Add package names
111 vars['project']=plugins113 vars['project']=plugins
112 vars['package']=plugins114 vars['package']=plugins
115 vars['deployment'] = self.options.deployment
116 vars['baseline'] = self.options.baseline
117 vars['python_version'] = self.options.python_version
118 vars['logging'] = self.options.logging
119 vars['vhost'] = self.options.vhost
120 vars['embedded'] = self.options.embedded
121 if self.options.virtualenv == os.pathsep and vars['baseline']:
122 # user didn't specify, use (calculated) default
123 # basically the package name next to baseline...
124 virtualenv = os.path.join(
125 os.path.dirname( vars['baseline'] ),
126 plugins,
127 )
128 elif self.options.virtualenv:
129 # explicit
130 virtualenv = self.options.virtualenv
131 else:
132 # not specified and no baseline
133 virtualenv = ''
134 vars['virtualenv'] = virtualenv
135 if self.options.vhost:
136 default_mount = '/'
137 else:
138 default_mount = '/%s'%( plugins, )
139 vars['mount'] = self.options.mount or default_mount
140 if not vars['mount'].endswith( '/' ):
141 vars['mount'] += '/'
142 vars['config'] = self.options.config
143
113 vars['egg']=pluginlib.egg_name(str(dist_name))144 vars['egg']=pluginlib.egg_name(str(dist_name))
114 145
146 log.info(
147 'Generating Apache2 Configuration in %s with:\n%s',
148 output_dir,
149 pprint.pformat( vars ),
150 )
151 self.validate_vars( vars )
152
115 #Copy my template direcotry to destination.153 #Copy my template direcotry to destination.
116 copy_dir(input_dir, output_dir, vars, verbosity=1, simulate=False, use_cheetah=True)154 copy_dir(input_dir, output_dir, vars, verbosity=1, simulate=False, use_cheetah=True)
117 print 'Thank you for using modwsgideploy!'155 log.info( 'Thank you for using modwsgideploy!' )
118 print 'Please read README.txt in apache folder.'156 log.info( 'Please read README.txt in apache folder.' )
119 print 'http://lucasmanual.com/mywiki/modwsgideploy'157 log.info( 'http://lucasmanual.com/mywiki/modwsgideploy' )
120 print 'Made in Chicago,IL USA'158 log.info( 'Made in Chicago,IL USA' )
121159
160 def validate_vars( self, vars ):
161 """Validate variables and log warnings"""
162 if not os.path.exists( vars['deployment'] ):
163 log.warn(
164 "You need to create the deployment directory\n\tmkdir %s",
165 vars['deployment'],
166 )
167 final_dir = os.path.join( vars['deployment'], vars['package'] )
168 final_file = os.path.join( final_dir, vars['config'] )
169 egg_dir = os.path.join( final_dir, 'python-eggs' )
170 if not os.path.exists( final_dir ):
171 log.warn(
172 "You need to move/copy/checkout your project to the deployment directory:\n\tcp -r ../%s %s/\n\tchown -R www-data:www-data %s/%s",
173 vars['package'],
174 vars['deployment'],
175 vars['deployment'],vars['package'],
176 )
177 if not os.path.exists( final_file ):
178 log.warn(
179 'You need to create a %s file, edit it for production, and install it in %s:\n\tpaster make-config %s %s\n\tcp %s %s',
180 vars['config'],
181 final_dir,
182 vars['package'],
183 vars['config'],
184 vars['config'],
185 final_dir,
186 )
187 if not os.path.exists( egg_dir ):
188 log.warn(
189 'You need to create an egg-unpacking directory:\n\tmkdir %s\n\tchown www-data:www-data %s',
190 egg_dir,
191 egg_dir,
192 )
193 if not vars['baseline']:
194 log.warn(
195 "You have disabled BASELINE environment support, this is not recommended!",
196 )
197 elif not os.path.exists( vars['baseline'] ):
198 parent = os.path.dirname( vars['baseline'] )
199 log.warn(
200 "You need to create the BASELINE VirtualEnv:\n\tmkdir %s\n\tcd %s\n\tvirtualenv --no-site-packages %s\n\tchown -R www-data:www-data %s",
201 parent,
202 parent,
203 os.path.basename( vars['baseline'] ),
204 os.path.basename( vars['baseline'] ),
205 )
206 if vars['virtualenv'] and not os.path.exists( vars['virtualenv'] ):
207 log.warn(
208 "You need to create your application's VirtualEnv:\n\tmkdir %s\n\tcd %s\n\tvirtualenv --no-site-packages %s\n\tchown -R www-data:www-data %s\n\t#install packages into this virtualenv now",
209 vars['virtualenv'],
210 vars['virtualenv'],
211 os.path.basename( vars['virtualenv'] ),
212 os.path.basename( vars['virtualenv'] ),
213 )
214 if vars['embedded']:
215 log.warn( 'Embedded mode is not recommended for Linux or OSX servers' )
216 return vars
122217
=== modified file 'trunk/modwsgideploy/templates/apache/+package+.wsgi_tmpl'
--- trunk/modwsgideploy/templates/apache/+package+.wsgi_tmpl 2009-10-17 18:05:06 +0000
+++ trunk/modwsgideploy/templates/apache/+package+.wsgi_tmpl 2010-03-08 17:56:30 +0000
@@ -1,51 +1,89 @@
1\#modwsgi script for $package1"""Apache mod_wsgi script for ${package}
22
3\#1.Point to this script in your apache config file.3Point to this script in your apache config file.
4\#Default location for all apps is:4A template config file was generated as the file `${package}` sitting
5\#Debian: /usr/local/turbogears/${package}5next to this file
66
7\#2. Make sure apache user own the folder.7Make sure the apache user (normally www-data) owns your application's
8\#Debian: chown -R www-data:www-data /usr/local/turbogears/${package}8deployment path (${deployment}/${package}). On Linux machines you can
99accomplish this with:
10
11.. code-block:: bash
12
13 sudo chown -R www-data:www-data ${deployment}/${package}
14
15#if $baseline
16The BASELINE pattern creates a root VirtualEnv on which your
17application-specific VirtualEnv's will be based, and which will
18can shared among potentially multiple projects. If you haven't
19yet created the BASELINE VirtualEnv you can created it with:
20
21.. code-block:: bash
22
23 sudo mkdir /usr/local/pythonenv
24 sudo virtualenv --no-site-packages ${baseline}
25
26Make sure that the apache user owns the ${baseline} virtualenv.
27On Linux machines you can ensure this with:
28
29.. code-block:: bash
30
31 sudo chown -R www-data:www-data ${baseline}
32#else
33You have not configured BASELINE support. If you wish to include it,
34either specify a --baseline=somedir parameter to `paster modwsgi_deploy`
35or leave off the baseline parameter entirely to use the default.
36#end if
37
38For details on BASELINE and the general mod_wsgi/VirtualEnv pattern
39used here, see:
40
41 http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
42"""
10import sys43import sys
1144
12\#3. start of virtualenv (enabled by default).45#if $baseline
13\#Please comment out until 4 if you don't use virtualenv. 46\# This block provides support for the default virtualenv
14\#Make sure root owns the virtualenv folder. Example:(root:root)47\# deployment pattern. The option `--virtualenv=` on the
15\#Create virtualenv if you didn't create it yet:48\# `paster modwsgi_deploy` command line will skip this section entirely.
16\#mkdir /usr/local/pythonenv
17\#virtualenv --no-site-packages /usr/local/pythonenv/BASELINE
18
19prev_sys_path = list(sys.path)49prev_sys_path = list(sys.path)
2050
21import site 51import site
22site.addsitedir('/usr/local/pythonenv/BASELINE/lib/python2.5/site-packages')52site.addsitedir('${virtualenv}/lib/${python_version}/site-packages')
2353
24\#Move just added item to the front of the python system path. 54\#Move just added item to the front of the python system path.
25\#Not needed if modwsgi>=3.0. Uncomment next 6 lines.55\#Not needed if modwsgi>=3.0. Uncomment next 6 lines.
26new_sys_path = []56new_sys_path = []
27for item in list(sys.path):57for item in list(sys.path):
28 if item not in prev_sys_path:58 if item not in prev_sys_path:
29 new_sys_path.append(item)59 new_sys_path.append(item)
30 sys.path.remove(item)60 sys.path.remove(item)
31sys.path[:0] = new_sys_path 61sys.path[:0] = new_sys_path
3262\#End of virtualenv support
33\#End of virtualenv63
3464#end if
35\#4. Your website file location.65\# This adds your project's root path to the PYTHONPATH so that you can import
66\# top-level modules from your project path. This is how TurboGears QuickStarted
67\# projects are laid out by default.
36import os, sys68import os, sys
37sys.path.append('/usr/local/turbogears/${package}')69sys.path.append('${deployment}/${package}')
3870
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.71\# Set the environment variable PYTHON_EGG_CACHE to an appropriate directory
40os.environ['PYTHON_EGG_CACHE'] = '/usr/local/turbogears/${package}/python-eggs'72\# where the Apache user has write permission and into which it can unpack egg files.
4173os.environ['PYTHON_EGG_CACHE'] = '${deployment}/${package}/python-eggs'
42\#6.[Optional]If you want to enable logging you need to initialize logging. You also need to setup logger handlers in your production.ini. When done uncomment next two lines.74
75#if logging
76\# Initialize logging module from your TurboGears config file
77from paste.script.util.logging_config import fileConfig
78fileConfig('${deployment}/${package}/${config}')
79#else
80\# If you want to enable logging you need to initialize logging.
81\# You also need to setup logger handlers in your ${config}.
82\# When done uncomment next two lines.
43\#from paste.script.util.logging_config import fileConfig83\#from paste.script.util.logging_config import fileConfig
44\#fileConfig('/usr/local/turbogears/${package}/production.ini')84\#fileConfig('${deployment}/${package}/${config}')
85#end if
4586
46\#7. Load your application production.ini file.87\# Finally, load your application's ${config} file.
47from paste.deploy import loadapp88from paste.deploy import loadapp
48application = loadapp('config:/usr/local/turbogears/${package}/production.ini')89application = loadapp('config:${deployment}/${package}/${config}')
49
50
51\#8.[Optional] If you want to test modwsgi only, uncomment section 3 in your /usr/local/turbogears/${package}/apache/${package}
5290
=== modified file 'trunk/modwsgideploy/templates/apache/+package+_tmpl'
--- trunk/modwsgideploy/templates/apache/+package+_tmpl 2009-10-21 21:13:01 +0000
+++ trunk/modwsgideploy/templates/apache/+package+_tmpl 2010-03-08 17:56:30 +0000
@@ -1,50 +1,71 @@
1\#Apache configuration File1\# Apache configuration File for ${package}
2\#Read README.txt2\# Read README.txt
3\#1. This file is the apache2 config file. It should be added to your apache config folder. If you mounting your app as a site wide package, you can rename the file to something like 002-${package} and put anything else that you want to be available in 001-someapp; When done copy to apache config folder. On Debian copy to /etc/apache2/sites-available/3\# This should be added to your apache config folder.
4\#cp ./apache/${package} /etc/apache2/sites-available/${package}4\# If you are mounting your app as a site wide you can rename the file
5\#a2ensite ${package}5\# to something like `002-${package}`
66\# and put anything else that you want to be available in 001-someapp;
77\# When done editing this file copy to apache config folder.
8\#Default location for tg2 project is /usr/local/turbogears/${package}. 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.8\# On Debian copy to /etc/apache2/sites-available/
99\# cp ./apache/${package} /etc/apache2/sites-available/${package}
10\#2. Alias/Allow apache to serve static content.10\# a2ensite ${package}
11Alias /${package}/images /usr/local/turbogears/${package}/${package}/public/images11
12Alias /${package}/css /usr/local/turbogears/${package}/${package}/public/css12\# Your TurboGears project needs to be installed at::
13Alias /${package}/javascript /usr/local/turbogears/${package}/${package}/public/javascript13\# ${deployment}/${package}
1414\# So that this file is present::
15\#[Optional] Embeded mode (http://example.com/${package}).For big websites with a lot of memory and visitors. As of version 0.4.16 deamon mode is default and it should be used on Linux. On windows use embeded mode.15\# ${deployment}/${package}/${config}
16 16\# You can reconfigure this with::
17\#WSGIScriptAlias /${package} /usr/local/turbogears/${package}/apache/${package}.wsgi17\# paster modwsgi_deploy --deployment=somedir
1818\# This folder should be outside of apache's "file" location.
19\#3. Test if modwsgi is working. Uncomment below line, and go to http://localhost/test:19\# Your package should not be installed into python site-package.
20\#WSGIScriptAlias /test /usr/local/turbogears/${package}/apache/test.wsgi20
2121#if $baseline
22\#4. [Optional] Sitewide (http://example.com/)22WSGIPythonHome ${baseline}
23\#Alias /images /usr/local/turbogears/${package}/${package}/public/images23#end if
24\#Alias /css /usr/local/turbogears/${package}/${package}/public/css24\# TODO: confirm that this line is appropriate for Daemon mode...
25\#Alias /javascript /usr/local/turbogears/${package}/${package}/public/javascript25WSGIPythonPath ${virtualenv}/lib/${python_version}/site-packages
26\#WSGIScriptAlias / /usr/local/turbogears/apache/${package}.wsgi26
2727
28\#5.Deamon mode with 10 threads and 3 processes. For small to medium website.28#if $vhost
29\# VirtualHost support is enabled:
30\# the '*' here specifies "all ip addresses on the host", you can use
31\# *:port to specify a non-standard port on all ip addresses, or specify
32\# a particular IP address rather than *
33\# This first line tells apache to enable Named Virtual Hosts on all IPs
34\# If you see a warning from Apache saying that NameVirtualHost *:80 has
35\# no virtual hosts, you likely are on Ubuntu and the base installation of
36\# Apache has set up an *:80 NameVirtualHost already, you can ignore the
37\# error or comment out the following line.
38
39NameVirtualHost *
40
41\# This block configures our particular named virtual host
42<VirtualHost *>
43 ServerName ${vhost}
44#end if
45\# Allow apache to serve static content.
46\# Your site is configured to mount at ${mount} (use --mount to change this)
47
48Alias ${mount}images ${deployment}/${package}/${package}/public/images
49Alias ${mount}css ${deployment}/${package}/${package}/public/css
50Alias ${mount}javascript ${deployment}/${package}/${package}/public/javascript
51
52\# Choose deamon mode with 10 threads and 3 processes.
53\# For small to medium website.
54#if not $embedded
29WSGIDaemonProcess ${package} threads=10 processes=355WSGIDaemonProcess ${package} threads=10 processes=3
30WSGIProcessGroup ${package}56WSGIProcessGroup ${package}
31WSGIScriptAlias /${package} /usr/local/turbogears/${package}/apache/${package}.wsgi57#end if
58WSGIScriptAlias ${mount} ${deployment}/${package}/apache/${package}.wsgi
3259
33\#6. Directory Permission.60\# Directory Permissions.
34<Directory /usr/local/turbogears/${package}/apache>61<Directory ${deployment}/${package}/apache>
35Order deny,allow62Order deny,allow
36Allow from all63Allow from all
37</Directory>64</Directory>
3865
39\#7. [Optional] If you want to use Virtualhost apache settings. 66#if $vhost
40\#Sample Virtual Host configuration would look like this:67</VirtualHost>
4168#else
42\#<Directory /usr/local/turbogears/${package}/apache>69\# You have not specified a VirtualHost name, pass --virtualhost=my.example.com
43\# Order allow,deny70\# to paster modwsgi_deploy to use VirtualHost support.
44\# Allow from all71#end if
45\#</Directory>
46
47\#NameVirtualHost *:81
48\#<VirtualHost *:81>
49\# WSGIScriptAlias / /usr/local/turbogears/${package}/apache/${package}.wsgi
50\#</VirtualHost>
5172
=== modified file 'trunk/modwsgideploy/templates/apache/README.txt_tmpl'
--- trunk/modwsgideploy/templates/apache/README.txt_tmpl 2009-10-17 18:05:06 +0000
+++ trunk/modwsgideploy/templates/apache/README.txt_tmpl 2010-03-08 17:56:30 +0000
@@ -1,37 +1,50 @@
1#Here is a numbered list of what you need to do to deploy your Turbogears2 or Pylons application. Follow 1 through 6. 1Here is the process to deploy your Turbogears2 or Pylons application.
22
3#1. Create production.ini configuration file if its not there already. Example: 3# Create production.ini configuration file (if it's not there already). Example::
4paster make-config ${package} production.ini4
5#Edit production.ini and comment out the port settings, update the url for the production database.5 paster make-config ${package} production.ini
66
7#2. Change or check the apache settings file.7 Edit production.ini and comment out the port settings, update the url
8#Edit /usr/local/turbogears/${package}/apache/${package} and make sure it has the necessary apache configurations you need. Please update any paths if youi are placing your app somewehere other then /usr/local/turbogears/${package}/8 for the production database.
99
10#Copy {$package} apache config file to apache folder. Example:10# Change or check the apache settings file (sitting next to this README) and
11cp /usr/local/turbogears/${package}/apache/${package} /etc/apache2/sites-available/${package}11 install it. Edit the file::
1212
13#3.Check if permissions are the same as other apache sites usually (root:root)13 apache/${package}
1414
15ls -l /etc/apache2/sites-available/15 and make sure it has the necessary apache configurations you need.
16#You shoud see16 Note: you may wish to re-run paster modwsgi_deploy with other options
17#total 1617 if you want to put your package in a nonstandard location.
18#-rw-r--r-- 1 root root 950 2008-08-08 13:06 default18
19#-rw-r--r-- 1 root root 7366 2008-08-08 13:06 default-ssl19# Copy {$package} apache config file to apache folder. Example::
20#-rw-r--r-- 1 root root 1077 2008-11-08 12:38 ${package}20
2121 cp ${package}/apache/${package} /etc/apache2/sites-available/${package}
22#4.Enable your site.22
23a2ensite ${package}23# Check if permissions are the same as other apache sites usually (root:root)::
2424
25#5. Check if your project has proper permissions, usually apache user. (Example: www-data:www-data on Debian).25 ls -l /etc/apache2/sites-available/
26ls -l /usr/local/turbogears/${package}/apache/26 total 16
27#total 1627 -rw-r--r-- 1 root root 950 2008-08-08 13:06 default
28#-rw-r--r-- 1 www-data www-data 1077 2008-11-26 22:35 ${package}28 -rw-r--r-- 1 root root 7366 2008-08-08 13:06 default-ssl
29#-rw-r--r-- 1 www-data www-data 2319 2008-11-26 23:25 ${package}.wsgi29 -rw-r--r-- 1 root root 1077 2008-11-08 12:38 ${package}
30#-rw-r--r-- 1 www-data www-data 594 2008-11-26 22:35 README.txt30
31#-rw-r--r-- 1 www-data www-data 538 2008-11-26 22:35 test.wsgi31# Enable your site::
3232
33#6.Reload apache33 a2ensite ${package}
34/etc/init.d/apache2 reload34
3535# Check if your project has proper permissions, usually apache user.
3636 (Example: www-data:www-data on Debian).::
37#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. 37
38 ls -l /usr/local/turbogears/${package}/apache/
39 total 16
40 -rw-r--r-- 1 www-data www-data 1077 2008-11-26 22:35 ${package}
41 -rw-r--r-- 1 www-data www-data 2319 2008-11-26 23:25 ${package}.wsgi
42 -rw-r--r-- 1 www-data www-data 594 2008-11-26 22:35 README.txt
43 -rw-r--r-- 1 www-data www-data 538 2008-11-26 22:35 test.wsgi
44
45# Reload apache::
46
47 /etc/init.d/apache2 reload
48
49You are done. Your application should be working. Check the access.log,
50warn.log, and error.log in /var/log/apache to see if there are any errors.

Subscribers

People subscribed via source and target branches

to all changes: