diff --git a/modules/django.py b/modules/django.py index 7c1aa9c..5acd364 100644 --- a/modules/django.py +++ b/modules/django.py @@ -12,9 +12,6 @@ from utils import generate_template_files_path import os -SCRIPT_LIST = ['settings', 'local', 'wsgi', 'gunicorn'] - - def generate_secret_key(): """ helper to generate django secret key @@ -357,19 +354,22 @@ def generate_scripts(template_name, make_copy=False): @task -def generate(script, make_copy=False): +def generate(param=None, make_copy=False): + SCRIPT_LIST = ['settings', 'local', 'wsgi'] + PARAM_LIST = SCRIPT_LIST + list('gunicorn') make_copy = booleanize(make_copy) - if script not in SCRIPT_LIST: + if param and param not in PARAM_LIST: err_msg = "You asked to generate a script that isn't available" \ "possible script values available: %s" % SCRIPT_LIST + import sys sys.exit(err_msg) print "django:generate make_copy : %s\n" % make_copy if env.debug: - print "django:generate script : %s" % script + print "django:generate script : %s" % param print "django:generate make_copy : %s\n" % make_copy else: pass @@ -378,10 +378,16 @@ def generate(script, make_copy=False): # those fucntion env.debug will be used to decide if anything should # happen or not - if script == 'gunicorn': + if not param: + # this is where script=None, generate all scripts + + for scriptkey in SCRIPT_LIST: + generate_scripts(scriptkey, make_copy) + + elif param == 'gunicorn': generate_gunicorn(make_link=make_copy) else: - generate_scripts(script, make_copy) + generate_scripts(param, make_copy) def generate_gunicorn(make_link=True):