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
1=== modified file 'trunk/README.txt'
2--- trunk/README.txt 2009-09-27 03:29:25 +0000
3+++ trunk/README.txt 2010-03-08 17:56:30 +0000
4@@ -34,7 +34,7 @@
5 cd modwsgideploy_code/trunk
6 python setup.py develop
7
8-Run modwsgi_deploy
9+Run modwsgi_deploy
10 ------------------
11
12 Go into your python application project folder and type in::
13@@ -45,7 +45,7 @@
14 Example
15 -------
16
17-Here is a typical installation, from start to finish on Debian Linux. You might have to use you OS specific commands for installing apache.
18+Here is a typical installation, from start to finish on Debian Linux. You might have to use you OS specific commands for installing apache.
19
20 The steps are:
21 1) Install apache and modwsgi
22@@ -62,7 +62,7 @@
23 source BASELINE/bin/activate
24 easy_install -i http://www.turbogears.org/2.0/downloads/current/index tg.devtools
25 paster quickstart myapp
26-
27+
28 Install modwsgideploy::
29
30 easy_install modwsgideploy
31@@ -80,14 +80,14 @@
32 | |-- myapp
33 | |-- myapp.wsgi
34 | `-- test.wsgi
35-
36+
37
38 1. Read the README.txt
39 2. myapp is a apache configuration file that you need to copy into your apache configuration folder after all the settings are set.
40 3. myapp.wsgi is an modwsgi script that is called from myapp apache file
41 4. test.wsgi is a test script that you can call to see if you modwsgi was properly installed and working.
42
43-Edit myapp file to change any paths and/or apache configurations. Then copy to apache folder.
44+Edit myapp file to change any paths and/or apache configurations. Then copy to apache folder.
45
46 On my operating system I copy this file to::
47
48@@ -103,5 +103,5 @@
49 Feedback
50 --------
51
52-If you have a useful sample wsgi script or apache config that you would like to share, please sent it to Turbogears mailing list.
53+If you have a useful sample wsgi script or apache config that you would like to share, please send it to Turbogears mailing list.
54
55
56=== modified file 'trunk/modwsgideploy.egg-info/PKG-INFO'
57--- trunk/modwsgideploy.egg-info/PKG-INFO 2009-09-27 03:58:24 +0000
58+++ trunk/modwsgideploy.egg-info/PKG-INFO 2010-03-08 17:56:30 +0000
59@@ -1,6 +1,6 @@
60 Metadata-Version: 1.0
61 Name: modwsgideploy
62-Version: 0.4.18dev
63+Version: 0.4.20dev
64 Summary: Deploy Turbogears2 or Pylons via apache and modwsgi.
65 Home-page: http://lucasmanual.com/mywiki/modwsgideploy
66 Author: Lukasz Szybalski
67
68=== modified file 'trunk/modwsgideploy.egg-info/entry_points.txt'
69--- trunk/modwsgideploy.egg-info/entry_points.txt 2009-04-10 20:17:26 +0000
70+++ trunk/modwsgideploy.egg-info/entry_points.txt 2010-03-08 17:56:30 +0000
71@@ -1,4 +1,4 @@
72
73 [paste.global_paster_command]
74 modwsgi_deploy = modwsgideploy.commands:ModwsgiCommand
75-
76\ No newline at end of file
77+
78\ No newline at end of file
79
80=== modified file 'trunk/modwsgideploy/commands.py'
81--- trunk/modwsgideploy/commands.py 2008-12-16 04:47:54 +0000
82+++ trunk/modwsgideploy/commands.py 2010-03-08 17:56:30 +0000
83@@ -7,48 +7,16 @@
84
85 modwsgi_deploy
86 """
87-
88 import os
89 import sys
90-
91+import logging, pprint
92+log = logging.getLogger( 'modwsgideploy' )
93 from paste.script.command import Command, BadCommand
94 from paste.script.filemaker import FileOp
95 from paste.script.copydir import copy_dir
96-
97-
98 #Needed to manipulate egg information
99 from paste.script import pluginlib
100
101-def can_import(name):
102- """Attempt to __import__ the specified package/module, returning True when
103- succeeding, otherwise False"""
104- try:
105- __import__(name)
106- return True
107- except ImportError:
108- return False
109-
110-def validateName(name):
111- """Validate that the name for the layer isn't present on the
112- path already"""
113- if not name:
114- # This happens when the name is an existing directory
115- raise BadCommand('Please give the name of a layer.')
116- # 'setup' is a valid controller name, but when paster controller is ran
117- # from the root directory of a project, importing setup will import the
118- # project's setup.py causing a sys.exit(). Blame relative imports
119- if name != 'setup' and can_import(name):
120- raise BadCommand(
121- "\n\nA module named '%s' is already present in your "
122- "PYTHON_PATH.\nChoosing a conflicting name will likely cause "
123- "import problems in\nyour controller at some point. It's "
124- "suggested that you choose an\nalternate name, and if you'd "
125- "like that name to be accessible as\n'%s', add a route "
126- "to your projects config/routing.py file similar\nto:\n"
127- " map.connect('%s', controller='my_%s')" \
128- % (name, name, name, name))
129- return True
130-
131 class ModwsgiCommand(Command):
132 """Create a modwsgi apache configuration.
133
134@@ -57,17 +25,10 @@
135 Example usage::
136
137 yourproj% paster modwsgi_deploy
138- Creating yourproj/yourproj/controllers/foos.py
139- Creating yourproj/yourproj/tests/functional/test_foos.py
140-
141- If you'd like to have controllers underneath a directory, just include
142- the path as the controller name and the necessary directories will be
143- created for you::
144-
145- yourproj% paster geo-controller admin/foos
146- Creating yourproj/controllers/admin
147- Creating yourproj/yourproj/controllers/admin/foos.py
148- Creating yourproj/yourproj/tests/functional/test_admin_foos.py
149+
150+ Or, with logging enabled:
151+
152+ yourproj% paster modwsgi_deploy --logging
153 """
154 summary = __doc__.splitlines()[0]
155 usage = '\n' + __doc__
156@@ -79,17 +40,58 @@
157 default_verbosity = 3
158
159 parser = Command.standard_parser(simulate=True)
160- parser.add_option('--no-test',
161- action='store_true',
162- dest='no_test',
163- help="Don't create the test; just the controller")
164 parser.add_option('-o', '--output-dir',
165 dest='output_dir',
166 metavar='DIR',
167 default='.',
168- help="Write put the directory into DIR (default current directory)")
169+ help="Write Apache2 configuration files in DIR/apache (default current directory)")
170+ parser.add_option('-b', '--baseline',
171+ dest='baseline',
172+ metavar='DIR',
173+ default='/usr/local/pythonenv/BASELINE',
174+ help="Path to the BASELINE VirtualEnv shared by applications, if set to '', then no BASELINE VirtualEnv is configured")
175+ parser.add_option('-e', '--virtualenv',
176+ dest='virtualenv',
177+ action='store',
178+ default=os.pathsep,
179+ help="Path to the application's VirtualEnv, if explicitly set to '', use system python, if not specified, use directory <package_name> next to BASELINE")
180+ parser.add_option('-d', '--deployment',
181+ dest='deployment',
182+ metavar='DIR',
183+ default='/usr/local/turbogears',
184+ help="Path where applications are installed, your app will be ${deployment}/package_name")
185+ parser.add_option('-c', '--config',
186+ dest='config',
187+ action="store",
188+ default = 'production.ini',
189+ help="Name of the TurboGears2 configuration file (default production.ini)")
190+ parser.add_option('-p', '--python',
191+ dest='python_version',
192+ default='python%s.%s'%( sys.version_info[:2] ),
193+ help="Python version for the deployment")
194+ parser.add_option('-l', '--logging',
195+ dest='logging',
196+ action="store_true",
197+ default=False,
198+ help="Whether to enable logging for the config (default False)")
199+ parser.add_option('-m', '--subsite',
200+ dest='mount',
201+ action="store",
202+ default = '',
203+ 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")
204+ parser.add_option('-H', '--virtualhost',
205+ dest='vhost',
206+ action="store",
207+ default = '',
208+ help="Virtual Host (Domain Name) to use for this configuration, such as 'myvirtual.mydomain.com', default is not to use a VirtualHost")
209+ parser.add_option('-E', '--embedded-mode',
210+ dest='embedded',
211+ action='store_true',
212+ default=False,
213+ help="Use mod_wsgi embedded mode (only recommended on Win32)")
214 def command(self):
215 """Main command to create a modwsgi configuration files"""
216+ logging.basicConfig(level=logging.INFO)
217 #Output directory is current folder unless specified vi output command.
218 output_dir = os.path.join(self.options.output_dir, 'apache')
219 #Input where the templates are at.
220@@ -110,12 +112,105 @@
221 #Add package names
222 vars['project']=plugins
223 vars['package']=plugins
224+ vars['deployment'] = self.options.deployment
225+ vars['baseline'] = self.options.baseline
226+ vars['python_version'] = self.options.python_version
227+ vars['logging'] = self.options.logging
228+ vars['vhost'] = self.options.vhost
229+ vars['embedded'] = self.options.embedded
230+ if self.options.virtualenv == os.pathsep and vars['baseline']:
231+ # user didn't specify, use (calculated) default
232+ # basically the package name next to baseline...
233+ virtualenv = os.path.join(
234+ os.path.dirname( vars['baseline'] ),
235+ plugins,
236+ )
237+ elif self.options.virtualenv:
238+ # explicit
239+ virtualenv = self.options.virtualenv
240+ else:
241+ # not specified and no baseline
242+ virtualenv = ''
243+ vars['virtualenv'] = virtualenv
244+ if self.options.vhost:
245+ default_mount = '/'
246+ else:
247+ default_mount = '/%s'%( plugins, )
248+ vars['mount'] = self.options.mount or default_mount
249+ if not vars['mount'].endswith( '/' ):
250+ vars['mount'] += '/'
251+ vars['config'] = self.options.config
252+
253 vars['egg']=pluginlib.egg_name(str(dist_name))
254-
255+
256+ log.info(
257+ 'Generating Apache2 Configuration in %s with:\n%s',
258+ output_dir,
259+ pprint.pformat( vars ),
260+ )
261+ self.validate_vars( vars )
262+
263 #Copy my template direcotry to destination.
264 copy_dir(input_dir, output_dir, vars, verbosity=1, simulate=False, use_cheetah=True)
265- print 'Thank you for using modwsgideploy!'
266- print 'Please read README.txt in apache folder.'
267- print 'http://lucasmanual.com/mywiki/modwsgideploy'
268- print 'Made in Chicago,IL USA'
269+ log.info( 'Thank you for using modwsgideploy!' )
270+ log.info( 'Please read README.txt in apache folder.' )
271+ log.info( 'http://lucasmanual.com/mywiki/modwsgideploy' )
272+ log.info( 'Made in Chicago,IL USA' )
273
274+ def validate_vars( self, vars ):
275+ """Validate variables and log warnings"""
276+ if not os.path.exists( vars['deployment'] ):
277+ log.warn(
278+ "You need to create the deployment directory\n\tmkdir %s",
279+ vars['deployment'],
280+ )
281+ final_dir = os.path.join( vars['deployment'], vars['package'] )
282+ final_file = os.path.join( final_dir, vars['config'] )
283+ egg_dir = os.path.join( final_dir, 'python-eggs' )
284+ if not os.path.exists( final_dir ):
285+ log.warn(
286+ "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",
287+ vars['package'],
288+ vars['deployment'],
289+ vars['deployment'],vars['package'],
290+ )
291+ if not os.path.exists( final_file ):
292+ log.warn(
293+ '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',
294+ vars['config'],
295+ final_dir,
296+ vars['package'],
297+ vars['config'],
298+ vars['config'],
299+ final_dir,
300+ )
301+ if not os.path.exists( egg_dir ):
302+ log.warn(
303+ 'You need to create an egg-unpacking directory:\n\tmkdir %s\n\tchown www-data:www-data %s',
304+ egg_dir,
305+ egg_dir,
306+ )
307+ if not vars['baseline']:
308+ log.warn(
309+ "You have disabled BASELINE environment support, this is not recommended!",
310+ )
311+ elif not os.path.exists( vars['baseline'] ):
312+ parent = os.path.dirname( vars['baseline'] )
313+ log.warn(
314+ "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",
315+ parent,
316+ parent,
317+ os.path.basename( vars['baseline'] ),
318+ os.path.basename( vars['baseline'] ),
319+ )
320+ if vars['virtualenv'] and not os.path.exists( vars['virtualenv'] ):
321+ log.warn(
322+ "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",
323+ vars['virtualenv'],
324+ vars['virtualenv'],
325+ os.path.basename( vars['virtualenv'] ),
326+ os.path.basename( vars['virtualenv'] ),
327+ )
328+ if vars['embedded']:
329+ log.warn( 'Embedded mode is not recommended for Linux or OSX servers' )
330+ return vars
331
332=== modified file 'trunk/modwsgideploy/templates/apache/+package+.wsgi_tmpl'
333--- trunk/modwsgideploy/templates/apache/+package+.wsgi_tmpl 2009-10-17 18:05:06 +0000
334+++ trunk/modwsgideploy/templates/apache/+package+.wsgi_tmpl 2010-03-08 17:56:30 +0000
335@@ -1,51 +1,89 @@
336-\#modwsgi script for $package
337-
338-\#1.Point to this script in your apache config file.
339-\#Default location for all apps is:
340-\#Debian: /usr/local/turbogears/${package}
341-
342-\#2. Make sure apache user own the folder.
343-\#Debian: chown -R www-data:www-data /usr/local/turbogears/${package}
344-
345+"""Apache mod_wsgi script for ${package}
346+
347+Point to this script in your apache config file.
348+A template config file was generated as the file `${package}` sitting
349+next to this file
350+
351+Make sure the apache user (normally www-data) owns your application's
352+deployment path (${deployment}/${package}). On Linux machines you can
353+accomplish this with:
354+
355+.. code-block:: bash
356+
357+ sudo chown -R www-data:www-data ${deployment}/${package}
358+
359+#if $baseline
360+The BASELINE pattern creates a root VirtualEnv on which your
361+application-specific VirtualEnv's will be based, and which will
362+can shared among potentially multiple projects. If you haven't
363+yet created the BASELINE VirtualEnv you can created it with:
364+
365+.. code-block:: bash
366+
367+ sudo mkdir /usr/local/pythonenv
368+ sudo virtualenv --no-site-packages ${baseline}
369+
370+Make sure that the apache user owns the ${baseline} virtualenv.
371+On Linux machines you can ensure this with:
372+
373+.. code-block:: bash
374+
375+ sudo chown -R www-data:www-data ${baseline}
376+#else
377+You have not configured BASELINE support. If you wish to include it,
378+either specify a --baseline=somedir parameter to `paster modwsgi_deploy`
379+or leave off the baseline parameter entirely to use the default.
380+#end if
381+
382+For details on BASELINE and the general mod_wsgi/VirtualEnv pattern
383+used here, see:
384+
385+ http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
386+"""
387 import sys
388
389-\#3. start of virtualenv (enabled by default).
390-\#Please comment out until 4 if you don't use virtualenv.
391-\#Make sure root owns the virtualenv folder. Example:(root:root)
392-\#Create virtualenv if you didn't create it yet:
393-\#mkdir /usr/local/pythonenv
394-\#virtualenv --no-site-packages /usr/local/pythonenv/BASELINE
395-
396+#if $baseline
397+\# This block provides support for the default virtualenv
398+\# deployment pattern. The option `--virtualenv=` on the
399+\# `paster modwsgi_deploy` command line will skip this section entirely.
400 prev_sys_path = list(sys.path)
401
402-import site
403-site.addsitedir('/usr/local/pythonenv/BASELINE/lib/python2.5/site-packages')
404+import site
405+site.addsitedir('${virtualenv}/lib/${python_version}/site-packages')
406
407-\#Move just added item to the front of the python system path.
408+\#Move just added item to the front of the python system path.
409 \#Not needed if modwsgi>=3.0. Uncomment next 6 lines.
410 new_sys_path = []
411 for item in list(sys.path):
412 if item not in prev_sys_path:
413 new_sys_path.append(item)
414 sys.path.remove(item)
415-sys.path[:0] = new_sys_path
416-
417-\#End of virtualenv
418-
419-\#4. Your website file location.
420+sys.path[:0] = new_sys_path
421+\#End of virtualenv support
422+
423+#end if
424+\# This adds your project's root path to the PYTHONPATH so that you can import
425+\# top-level modules from your project path. This is how TurboGears QuickStarted
426+\# projects are laid out by default.
427 import os, sys
428-sys.path.append('/usr/local/turbogears/${package}')
429-
430-\#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.
431-os.environ['PYTHON_EGG_CACHE'] = '/usr/local/turbogears/${package}/python-eggs'
432-
433-\#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.
434+sys.path.append('${deployment}/${package}')
435+
436+\# Set the environment variable PYTHON_EGG_CACHE to an appropriate directory
437+\# where the Apache user has write permission and into which it can unpack egg files.
438+os.environ['PYTHON_EGG_CACHE'] = '${deployment}/${package}/python-eggs'
439+
440+#if logging
441+\# Initialize logging module from your TurboGears config file
442+from paste.script.util.logging_config import fileConfig
443+fileConfig('${deployment}/${package}/${config}')
444+#else
445+\# If you want to enable logging you need to initialize logging.
446+\# You also need to setup logger handlers in your ${config}.
447+\# When done uncomment next two lines.
448 \#from paste.script.util.logging_config import fileConfig
449-\#fileConfig('/usr/local/turbogears/${package}/production.ini')
450+\#fileConfig('${deployment}/${package}/${config}')
451+#end if
452
453-\#7. Load your application production.ini file.
454+\# Finally, load your application's ${config} file.
455 from paste.deploy import loadapp
456-application = loadapp('config:/usr/local/turbogears/${package}/production.ini')
457-
458-
459-\#8.[Optional] If you want to test modwsgi only, uncomment section 3 in your /usr/local/turbogears/${package}/apache/${package}
460+application = loadapp('config:${deployment}/${package}/${config}')
461
462=== modified file 'trunk/modwsgideploy/templates/apache/+package+_tmpl'
463--- trunk/modwsgideploy/templates/apache/+package+_tmpl 2009-10-21 21:13:01 +0000
464+++ trunk/modwsgideploy/templates/apache/+package+_tmpl 2010-03-08 17:56:30 +0000
465@@ -1,50 +1,71 @@
466-\#Apache configuration File
467-\#Read README.txt
468-\#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/
469-\#cp ./apache/${package} /etc/apache2/sites-available/${package}
470-\#a2ensite ${package}
471-
472-
473-\#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.
474-
475-\#2. Alias/Allow apache to serve static content.
476-Alias /${package}/images /usr/local/turbogears/${package}/${package}/public/images
477-Alias /${package}/css /usr/local/turbogears/${package}/${package}/public/css
478-Alias /${package}/javascript /usr/local/turbogears/${package}/${package}/public/javascript
479-
480-\#[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.
481-
482-\#WSGIScriptAlias /${package} /usr/local/turbogears/${package}/apache/${package}.wsgi
483-
484-\#3. Test if modwsgi is working. Uncomment below line, and go to http://localhost/test:
485-\#WSGIScriptAlias /test /usr/local/turbogears/${package}/apache/test.wsgi
486-
487-\#4. [Optional] Sitewide (http://example.com/)
488-\#Alias /images /usr/local/turbogears/${package}/${package}/public/images
489-\#Alias /css /usr/local/turbogears/${package}/${package}/public/css
490-\#Alias /javascript /usr/local/turbogears/${package}/${package}/public/javascript
491-\#WSGIScriptAlias / /usr/local/turbogears/apache/${package}.wsgi
492-
493-\#5.Deamon mode with 10 threads and 3 processes. For small to medium website.
494+\# Apache configuration File for ${package}
495+\# Read README.txt
496+\# This should be added to your apache config folder.
497+\# If you are mounting your app as a site wide you can rename the file
498+\# to something like `002-${package}`
499+\# and put anything else that you want to be available in 001-someapp;
500+\# When done editing this file copy to apache config folder.
501+\# On Debian copy to /etc/apache2/sites-available/
502+\# cp ./apache/${package} /etc/apache2/sites-available/${package}
503+\# a2ensite ${package}
504+
505+\# Your TurboGears project needs to be installed at::
506+\# ${deployment}/${package}
507+\# So that this file is present::
508+\# ${deployment}/${package}/${config}
509+\# You can reconfigure this with::
510+\# paster modwsgi_deploy --deployment=somedir
511+\# This folder should be outside of apache's "file" location.
512+\# Your package should not be installed into python site-package.
513+
514+#if $baseline
515+WSGIPythonHome ${baseline}
516+#end if
517+\# TODO: confirm that this line is appropriate for Daemon mode...
518+WSGIPythonPath ${virtualenv}/lib/${python_version}/site-packages
519+
520+
521+#if $vhost
522+\# VirtualHost support is enabled:
523+\# the '*' here specifies "all ip addresses on the host", you can use
524+\# *:port to specify a non-standard port on all ip addresses, or specify
525+\# a particular IP address rather than *
526+\# This first line tells apache to enable Named Virtual Hosts on all IPs
527+\# If you see a warning from Apache saying that NameVirtualHost *:80 has
528+\# no virtual hosts, you likely are on Ubuntu and the base installation of
529+\# Apache has set up an *:80 NameVirtualHost already, you can ignore the
530+\# error or comment out the following line.
531+
532+NameVirtualHost *
533+
534+\# This block configures our particular named virtual host
535+<VirtualHost *>
536+ ServerName ${vhost}
537+#end if
538+\# Allow apache to serve static content.
539+\# Your site is configured to mount at ${mount} (use --mount to change this)
540+
541+Alias ${mount}images ${deployment}/${package}/${package}/public/images
542+Alias ${mount}css ${deployment}/${package}/${package}/public/css
543+Alias ${mount}javascript ${deployment}/${package}/${package}/public/javascript
544+
545+\# Choose deamon mode with 10 threads and 3 processes.
546+\# For small to medium website.
547+#if not $embedded
548 WSGIDaemonProcess ${package} threads=10 processes=3
549 WSGIProcessGroup ${package}
550-WSGIScriptAlias /${package} /usr/local/turbogears/${package}/apache/${package}.wsgi
551+#end if
552+WSGIScriptAlias ${mount} ${deployment}/${package}/apache/${package}.wsgi
553
554-\#6. Directory Permission.
555-<Directory /usr/local/turbogears/${package}/apache>
556+\# Directory Permissions.
557+<Directory ${deployment}/${package}/apache>
558 Order deny,allow
559 Allow from all
560 </Directory>
561
562-\#7. [Optional] If you want to use Virtualhost apache settings.
563-\#Sample Virtual Host configuration would look like this:
564-
565-\#<Directory /usr/local/turbogears/${package}/apache>
566-\# Order allow,deny
567-\# Allow from all
568-\#</Directory>
569-
570-\#NameVirtualHost *:81
571-\#<VirtualHost *:81>
572-\# WSGIScriptAlias / /usr/local/turbogears/${package}/apache/${package}.wsgi
573-\#</VirtualHost>
574+#if $vhost
575+</VirtualHost>
576+#else
577+\# You have not specified a VirtualHost name, pass --virtualhost=my.example.com
578+\# to paster modwsgi_deploy to use VirtualHost support.
579+#end if
580
581=== modified file 'trunk/modwsgideploy/templates/apache/README.txt_tmpl'
582--- trunk/modwsgideploy/templates/apache/README.txt_tmpl 2009-10-17 18:05:06 +0000
583+++ trunk/modwsgideploy/templates/apache/README.txt_tmpl 2010-03-08 17:56:30 +0000
584@@ -1,37 +1,50 @@
585-#Here is a numbered list of what you need to do to deploy your Turbogears2 or Pylons application. Follow 1 through 6.
586-
587-#1. Create production.ini configuration file if its not there already. Example:
588-paster make-config ${package} production.ini
589-#Edit production.ini and comment out the port settings, update the url for the production database.
590-
591-#2. Change or check the apache settings file.
592-#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}/
593-
594-#Copy {$package} apache config file to apache folder. Example:
595-cp /usr/local/turbogears/${package}/apache/${package} /etc/apache2/sites-available/${package}
596-
597-#3.Check if permissions are the same as other apache sites usually (root:root)
598-
599-ls -l /etc/apache2/sites-available/
600-#You shoud see
601-#total 16
602-#-rw-r--r-- 1 root root 950 2008-08-08 13:06 default
603-#-rw-r--r-- 1 root root 7366 2008-08-08 13:06 default-ssl
604-#-rw-r--r-- 1 root root 1077 2008-11-08 12:38 ${package}
605-
606-#4.Enable your site.
607-a2ensite ${package}
608-
609-#5. Check if your project has proper permissions, usually apache user. (Example: www-data:www-data on Debian).
610-ls -l /usr/local/turbogears/${package}/apache/
611-#total 16
612-#-rw-r--r-- 1 www-data www-data 1077 2008-11-26 22:35 ${package}
613-#-rw-r--r-- 1 www-data www-data 2319 2008-11-26 23:25 ${package}.wsgi
614-#-rw-r--r-- 1 www-data www-data 594 2008-11-26 22:35 README.txt
615-#-rw-r--r-- 1 www-data www-data 538 2008-11-26 22:35 test.wsgi
616-
617-#6.Reload apache
618-/etc/init.d/apache2 reload
619-
620-
621-#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.
622+Here is the process to deploy your Turbogears2 or Pylons application.
623+
624+# Create production.ini configuration file (if it's not there already). Example::
625+
626+ paster make-config ${package} production.ini
627+
628+ Edit production.ini and comment out the port settings, update the url
629+ for the production database.
630+
631+# Change or check the apache settings file (sitting next to this README) and
632+ install it. Edit the file::
633+
634+ apache/${package}
635+
636+ and make sure it has the necessary apache configurations you need.
637+ Note: you may wish to re-run paster modwsgi_deploy with other options
638+ if you want to put your package in a nonstandard location.
639+
640+# Copy {$package} apache config file to apache folder. Example::
641+
642+ cp ${package}/apache/${package} /etc/apache2/sites-available/${package}
643+
644+# Check if permissions are the same as other apache sites usually (root:root)::
645+
646+ ls -l /etc/apache2/sites-available/
647+ total 16
648+ -rw-r--r-- 1 root root 950 2008-08-08 13:06 default
649+ -rw-r--r-- 1 root root 7366 2008-08-08 13:06 default-ssl
650+ -rw-r--r-- 1 root root 1077 2008-11-08 12:38 ${package}
651+
652+# Enable your site::
653+
654+ a2ensite ${package}
655+
656+# Check if your project has proper permissions, usually apache user.
657+ (Example: www-data:www-data on Debian).::
658+
659+ ls -l /usr/local/turbogears/${package}/apache/
660+ total 16
661+ -rw-r--r-- 1 www-data www-data 1077 2008-11-26 22:35 ${package}
662+ -rw-r--r-- 1 www-data www-data 2319 2008-11-26 23:25 ${package}.wsgi
663+ -rw-r--r-- 1 www-data www-data 594 2008-11-26 22:35 README.txt
664+ -rw-r--r-- 1 www-data www-data 538 2008-11-26 22:35 test.wsgi
665+
666+# Reload apache::
667+
668+ /etc/init.d/apache2 reload
669+
670+You are done. Your application should be working. Check the access.log,
671+warn.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: