fix superuser setup

This commit is contained in:
JensDiemer 2020-12-29 12:02:57 +01:00
parent 9f0c74664d
commit 3d8b18788e
3 changed files with 7 additions and 13 deletions

View file

@ -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

View file

@ -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.

View file

@ -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