Skip to content

Commit

Permalink
outputs message with created project, added --quiet argument
Browse files Browse the repository at this point in the history
  • Loading branch information
steingrd committed Dec 28, 2008
1 parent c8a451a commit 8b6a6c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/django-project-template.py
Expand Up @@ -15,6 +15,7 @@
Options:
-a NAME, --appname=NAME name of application, default is myapp
-q, --quiet supress informational output messages
-h, --help show this message"""

import getopt
Expand Down Expand Up @@ -207,6 +208,11 @@ def create_project_template(projectname, **options):
else:
appname = 'myapp'

if 'quiet' in options:
quiet = options['quiet']
else:
quiet = False

create_directory(projectname)
create_directory(projectname, 'media')
create_directory(projectname, 'python')
Expand Down Expand Up @@ -236,6 +242,8 @@ def create_project_template(projectname, **options):
# set executable flag for manage.py
os.chmod(os.path.join(projectname, 'manage.py'), stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH)

if not quiet:
print 'Project %s created with application %s' % (projectname, appname)

def create_directory(dirname, *args):
"""
Expand Down Expand Up @@ -284,7 +292,7 @@ def generate_secret_key():

def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "ha:", ["help", "appname="])
opts, args = getopt.getopt(sys.argv[1:], "ha:q", ["help", "appname=", "quiet"])
except getopt.error, msg:
print msg
print "for help use --help"
Expand All @@ -302,6 +310,8 @@ def main():
sys.exit(0)
if o in ("-a", "--appname"):
options['appname' ] = a
if o in ("-q", "--quiet"):
options['quiet' ] = True

for a in args:
create_project_template(a, **options)
Expand Down

0 comments on commit 8b6a6c8

Please sign in to comment.