Added a superuser creation call to evennia.py to replace the automatic one that

was done by syncdb before.
This commit is contained in:
Griatch 2013-07-11 22:47:17 +02:00
parent a4042920e0
commit 607674c6cf
2 changed files with 7 additions and 5 deletions

View file

@ -129,11 +129,9 @@ PORTAL_LOGFILE = settings.PORTAL_LOG_FILE
# Check so a database exists and is accessible
from django.db import DatabaseError
from src.objects.models import ObjectDB
from src.players.models import PlayerDB
try:
test = ObjectDB.objects.get(id=1)
except ObjectDB.DoesNotExist:
pass # this is fine at this point
superuser = PlayerDB.objects.get(id=1)
except DatabaseError,e:
print """
Your database does not seem to be set up correctly.
@ -147,6 +145,11 @@ except DatabaseError,e:
When you have a database set up, rerun evennia.py.
""" % e
sys.exit()
except PlayerDB.DoesNotExist:
# no superuser yet. We need to create it.
from django.core.management import call_command
print "Create a superuser below. The superuser is Player #1, the 'owner' account of the server."
call_command("createsuperuser", interactive=True)
# Add this to the environmental variable for the 'twistd' command.
currpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

View file

@ -9,7 +9,6 @@ Everything starts at handle_setup()
import django
from django.core import management
from django.conf import settings
from django.core.management import call_command
from django.contrib.auth import get_user_model
from src.server.models import ServerConfig
from src.help.models import HelpEntry