summaryrefslogtreecommitdiff
path: root/paste/deploy/paster_templates.py
blob: 44348989716ce2eac1d99e1bd07f14f44142a472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
import os
from paste.script.templates import Template

class PasteDeploy(Template):

    _template_dir = 'paster_templates/paste_deploy'
    summary = "A web application deployed through paste.deploy"
    
    egg_plugins = ['PasteDeploy']
    
    required_templates = ['PasteScript#basic_package']

    def post(self, command, output_dir, vars):
        for prereq in ['PasteDeploy']:
            command.insert_into_file(
                os.path.join(output_dir, 'setup.py'),
                'Extra requirements',
                '%r,\n' % prereq,
                indent=True)
        command.insert_into_file(
            os.path.join(output_dir, 'setup.py'),
            'Entry points',
            ('      [paste.app_factory]\n'
             '      main = %(package)s.wsgiapp:make_app\n') % vars,
            indent=False)
        if command.verbose:
            print '*'*72
            print '* Run "paster serve docs/devel_config.ini" to run the sample application'
            print '* on http://localhost:8080'
            print '*'*72