From 3d8b18788e51385a896c59c019331301f77bb46d Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Tue, 29 Dec 2020 12:02:57 +0100 Subject: [PATCH] fix superuser setup --- django_ynh/local_test.py | 9 +-------- scripts/install | 7 ++++--- scripts/upgrade | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/django_ynh/local_test.py b/django_ynh/local_test.py index cf64c7b..e691bfc 100755 --- a/django_ynh/local_test.py +++ b/django_ynh/local_test.py @@ -105,14 +105,7 @@ def create_local_test(django_settings_path, destination, runserver=False): if runserver: call_manage_py(final_home_path, 'migrate --no-input') call_manage_py(final_home_path, 'collectstatic --no-input') - - verbose_check_call( - command=( - f'{sys.executable} -m django_ynh.create_superuser' - f' --ds="{django_settings_name}" --username="test" --password="test123"' - ), - cwd=final_home_path, - ) + call_manage_py(final_home_path, 'create_superuser --username="test"') os.environ['DJANGO_SETTINGS_MODULE'] = django_settings_name diff --git a/scripts/install b/scripts/install index f949f81..a9014cc 100755 --- a/scripts/install +++ b/scripts/install @@ -159,9 +159,9 @@ touch "$final_path/local_settings.py" cp "../conf/urls.py" "$final_path/urls.py" #================================================= -# MIGRATE / COLLECTSTATIC / CREATEADMIN +# MIGRATE / COLLECTSTATIC / CREATE SUPERUSER #================================================= -ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10 +ynh_script_progression --message="migrate/collectstatic/create superuser..." --weight=10 ( set +o nounset @@ -175,7 +175,8 @@ ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight ./manage.py migrate --no-input ./manage.py collectstatic --no-input - python -m django_ynh.create_superuser --ds="django_ynh_demo_settings" --username="$admin" --email="$admin_mail" --password="$app" + # Create/update Django superuser (set unusable password, because auth done via SSOwat): + ./manage.py create_superuser --username="$admin" --email="$admin_mail" # Check the configuration # This may fail in some cases with errors, etc., but the app works and the user can fix issues later. diff --git a/scripts/upgrade b/scripts/upgrade index be9bdd7..d5578b9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -147,9 +147,9 @@ touch "$final_path/local_settings.py" cp "../conf/urls.py" "$final_path/urls.py" #================================================= -# MIGRATE django_ynh +# MIGRATE / COLLECTSTATIC / CREATE SUPERUSER #================================================= -ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10 +ynh_script_progression --message="migrate/collectstatic/create superuser..." --weight=10 ( set +o nounset