Latest iteration of the new cross-platform startup script, please test!
This commit is contained in:
parent
51a648ddab
commit
6d93c4114f
1 changed files with 10 additions and 3 deletions
|
|
@ -13,10 +13,17 @@ from subprocess import Popen, call
|
||||||
|
|
||||||
# Set the Python path up so we can get to settings.py from here.
|
# Set the Python path up so we can get to settings.py from here.
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'game.settings'
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
SERVER_PY_FILE = os.path.join(settings.SRC_DIR, 'server.py')
|
SERVER_PY_FILE = os.path.join(settings.SRC_DIR, 'server.py')
|
||||||
|
|
||||||
|
# Determine what the twistd binary name is. Eventually may want to have a
|
||||||
|
# setting in settings.py to specify the path to the containing directory.
|
||||||
|
if os.name == 'nt':
|
||||||
|
TWISTED_BINARY = 'twistd.bat'
|
||||||
|
else:
|
||||||
|
TWISTED_BINARY = 'twistd'
|
||||||
|
|
||||||
# Add this to the environmental variable for the 'twistd' command.
|
# Add this to the environmental variable for the 'twistd' command.
|
||||||
os.environ['PYTHONPATH'] = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
os.environ['PYTHONPATH'] = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
|
@ -44,7 +51,7 @@ def start_daemon(parser, options, args):
|
||||||
cycle_logfile()
|
cycle_logfile()
|
||||||
|
|
||||||
# Start it up
|
# Start it up
|
||||||
Popen(['twistd',
|
Popen([TWISTED_BINARY,
|
||||||
'--logfile=%s' % settings.DEFAULT_LOG_FILE,
|
'--logfile=%s' % settings.DEFAULT_LOG_FILE,
|
||||||
'--python=%s' % SERVER_PY_FILE])
|
'--python=%s' % SERVER_PY_FILE])
|
||||||
|
|
||||||
|
|
@ -54,7 +61,7 @@ def start_interactive(parser, options, args):
|
||||||
all logging output is directed to stdout.
|
all logging output is directed to stdout.
|
||||||
"""
|
"""
|
||||||
print 'Starting in interactive mode...'
|
print 'Starting in interactive mode...'
|
||||||
call(['twistd',
|
call([TWISTED_BINARY,
|
||||||
'-n',
|
'-n',
|
||||||
'--python=%s' % SERVER_PY_FILE])
|
'--python=%s' % SERVER_PY_FILE])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue