From b0ace382739173db3c317d16f5f46e5f5e89face Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Wed, 24 Apr 2019 11:38:37 -0400 Subject: [PATCH] warn user that no admins exist when starting runserver --- archivebox/cli/archivebox_server.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/archivebox/cli/archivebox_server.py b/archivebox/cli/archivebox_server.py index 2955812a..3fdaff5c 100644 --- a/archivebox/cli/archivebox_server.py +++ b/archivebox/cli/archivebox_server.py @@ -7,7 +7,7 @@ __description__ = 'Run the ArchiveBox HTTP server' import sys import argparse -from ..legacy.config import setup_django, OUTPUT_DIR, ANSI, check_data_folder +from ..legacy.config import setup_django, IS_TTY, OUTPUT_DIR, ANSI, check_data_folder from ..legacy.util import reject_stdin @@ -38,7 +38,14 @@ def main(args=None): setup_django(OUTPUT_DIR) from django.core.management import call_command + from django.contrib.auth.models import User + if IS_TTY and not User.objects.filter(is_superuser=True).exists(): + print('{lightyellow}[!] No admin users exist yet, you will not be able to edit links in the UI.{reset}'.format(**ANSI)) + print() + print(' To create an admin user, run:') + print(' archivebox manage createsuperuser') + print() print('{green}[+] Starting ArchiveBox webserver...{reset}'.format(**ANSI)) if not command.reload: