Still hounded by chicken-and-egg situation where the evennia __init__ is not loaded at the time it is needed
This commit is contained in:
parent
f15e05c247
commit
6441859e61
1 changed files with 5 additions and 16 deletions
15
bin/evennia
15
bin/evennia
|
|
@ -454,15 +454,9 @@ def init_game_directory(path):
|
||||||
# the main library, it should show here.
|
# the main library, it should show here.
|
||||||
evennia = importlib.import_module("evennia")
|
evennia = importlib.import_module("evennia")
|
||||||
|
|
||||||
if check_database(automigrate=False, exit_on_error=False):
|
if check_database():
|
||||||
evennia.init()
|
evennia.init()
|
||||||
|
|
||||||
# check all dependencies
|
|
||||||
from evennia.utils.utils import check_evennia_dependencies
|
|
||||||
if not check_evennia_dependencies:
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
|
|
||||||
# set up the Evennia executables and log file locations
|
# set up the Evennia executables and log file locations
|
||||||
global SERVER_PY_FILE, PORTAL_PY_FILE
|
global SERVER_PY_FILE, PORTAL_PY_FILE
|
||||||
global SERVER_LOGFILE, PORTAL_LOGFILE, HTTP_LOGFILE
|
global SERVER_LOGFILE, PORTAL_LOGFILE, HTTP_LOGFILE
|
||||||
|
|
@ -483,7 +477,6 @@ def init_game_directory(path):
|
||||||
PORTAL_LOGFILE = settings.PORTAL_LOG_FILE
|
PORTAL_LOGFILE = settings.PORTAL_LOG_FILE
|
||||||
HTTP_LOGFILE = settings.HTTP_LOG_FILE
|
HTTP_LOGFILE = settings.HTTP_LOG_FILE
|
||||||
|
|
||||||
# set up twisted
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
# We need to handle Windows twisted separately. We create a
|
# We need to handle Windows twisted separately. We create a
|
||||||
# batchfile in game/server, linking to the actual binary
|
# batchfile in game/server, linking to the actual binary
|
||||||
|
|
@ -545,17 +538,13 @@ def create_superuser():
|
||||||
django.core.management.call_command("createsuperuser", interactive=True)
|
django.core.management.call_command("createsuperuser", interactive=True)
|
||||||
|
|
||||||
|
|
||||||
def check_database(automigrate=False, exit_on_error=True):
|
def check_database(exit_on_error=False):
|
||||||
# Check so a database exists and is accessible
|
# Check so a database exists and is accessible
|
||||||
from django.db import DatabaseError
|
from django.db import DatabaseError
|
||||||
from evennia.players.models import PlayerDB
|
from evennia.players.models import PlayerDB
|
||||||
try:
|
try:
|
||||||
PlayerDB.objects.get(id=1)
|
PlayerDB.objects.get(id=1)
|
||||||
except DatabaseError, e:
|
except DatabaseError, e:
|
||||||
if automigrate:
|
|
||||||
create_database()
|
|
||||||
create_superuser()
|
|
||||||
else:
|
|
||||||
if exit_on_error:
|
if exit_on_error:
|
||||||
print ERROR_DATABASE.format(traceback=e)
|
print ERROR_DATABASE.format(traceback=e)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue