Skip to content

Commit

Permalink
Report error more verbosely
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Dec 31, 2017
1 parent 66db300 commit eb9e89a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions djangocms_installer/config/__init__.py
Expand Up @@ -23,7 +23,7 @@ def parse(args):
"""
try:
timezone = get_localzone()
except:
except Exception: # pragma: no cover
timezone = 'UTC'
if timezone == 'local':
timezone = 'UTC'
Expand Down Expand Up @@ -207,7 +207,7 @@ def parse(args):
if not args.languages:
try:
args.languages = [locale.getdefaultlocale()[0].split('_')[0]]
except:
except Exception: # pragma: no cover
args.languages = ['en']
elif isinstance(args.languages, six.string_types):
args.languages = args.languages.split(',')
Expand Down
19 changes: 14 additions & 5 deletions djangocms_installer/django/__init__.py
Expand Up @@ -394,8 +394,13 @@ def setup_database(config_data):
)
)
for command in commands:
output = subprocess.check_output(command, env=env)
sys.stdout.write(output.decode('utf-8'))
try:
output = subprocess.check_output(
command, env=env, stderr=subprocess.STDOUT
)
sys.stdout.write(output.decode('utf-8'))
except subprocess.CalledProcessError:
raise

if not config_data.no_user:
sys.stdout.write('Creating admin user\n')
Expand All @@ -404,7 +409,7 @@ def setup_database(config_data):
else:
subprocess.check_call(' '.join(
[sys.executable, '-W', 'ignore', 'manage.py', 'createsuperuser']
), shell=True)
), shell=True, stderr=subprocess.STDOUT)


def create_user(config_data):
Expand All @@ -417,7 +422,9 @@ def create_user(config_data):
env = deepcopy(dict(os.environ))
env[str('DJANGO_SETTINGS_MODULE')] = str('{0}.settings'.format(config_data.project_name))
env[str('PYTHONPATH')] = str(os.pathsep.join(map(shlex_quote, sys.path)))
subprocess.check_call([sys.executable, 'create_user.py'], env=env)
subprocess.check_call(
[sys.executable, 'create_user.py'], env=env, stderr=subprocess.STDOUT
)
for ext in ['py', 'pyc']:
try:
os.remove('create_user.{0}'.format(ext))
Expand All @@ -435,7 +442,9 @@ def load_starting_page(config_data):
env = deepcopy(dict(os.environ))
env[str('DJANGO_SETTINGS_MODULE')] = str('{0}.settings'.format(config_data.project_name))
env[str('PYTHONPATH')] = str(os.pathsep.join(map(shlex_quote, sys.path)))
subprocess.check_call([sys.executable, 'starting_page.py'], env=env)
subprocess.check_call(
[sys.executable, 'starting_page.py'], env=env, stderr=subprocess.STDOUT
)
for ext in ['py', 'pyc', 'json']:
try:
os.remove('starting_page.{0}'.format(ext))
Expand Down

0 comments on commit eb9e89a

Please sign in to comment.