Added collectstatic to start/reload.
This commit is contained in:
parent
7d12c6dd69
commit
fa20190467
1 changed files with 8 additions and 1 deletions
|
|
@ -16,6 +16,8 @@ from optparse import OptionParser
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
|
|
||||||
# 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.
|
||||||
|
from django.core import management
|
||||||
|
|
||||||
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'] = 'game.settings'
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'game.settings'
|
||||||
|
|
||||||
|
|
@ -264,6 +266,8 @@ def kill(pidfile, signal=SIG, succmsg="", errmsg="", restart_file=SERVER_RESTART
|
||||||
return
|
return
|
||||||
os.remove(pidfile)
|
os.remove(pidfile)
|
||||||
# set restart/norestart flag
|
# set restart/norestart flag
|
||||||
|
if restart == 'reload':
|
||||||
|
management.call_command('collectstatic', interactive=False, verbosity=0)
|
||||||
f = open(restart_file, 'w')
|
f = open(restart_file, 'w')
|
||||||
f.write(str(restart))
|
f.write(str(restart))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
@ -389,11 +393,13 @@ def handle_args(options, mode, service):
|
||||||
if inter:
|
if inter:
|
||||||
cmdstr.append('--iportal')
|
cmdstr.append('--iportal')
|
||||||
cmdstr.append('--noserver')
|
cmdstr.append('--noserver')
|
||||||
|
management.call_command('collectstatic', verbosity=1, interactive=False)
|
||||||
else: # all
|
else: # all
|
||||||
# for convenience we don't start logging of
|
# for convenience we don't start logging of
|
||||||
# portal, only of server with this command.
|
# portal, only of server with this command.
|
||||||
if inter:
|
if inter:
|
||||||
cmdstr.extend(['--iserver'])
|
cmdstr.extend(['--iserver'])
|
||||||
|
management.call_command('collectstatic', verbosity=1, interactive=False)
|
||||||
return cmdstr
|
return cmdstr
|
||||||
|
|
||||||
elif mode == 'reload':
|
elif mode == 'reload':
|
||||||
|
|
@ -425,6 +431,7 @@ def handle_args(options, mode, service):
|
||||||
kill(SERVER_PIDFILE, SIG, "Server stopped.", errmsg % 'Server', restart="shutdown")
|
kill(SERVER_PIDFILE, SIG, "Server stopped.", errmsg % 'Server', restart="shutdown")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def error_check_python_modules():
|
def error_check_python_modules():
|
||||||
"""
|
"""
|
||||||
Import settings modules in settings. This will raise exceptions on
|
Import settings modules in settings. This will raise exceptions on
|
||||||
|
|
@ -509,7 +516,7 @@ def main():
|
||||||
if mode not in ['menu', 'start', 'reload', 'stop']:
|
if mode not in ['menu', 'start', 'reload', 'stop']:
|
||||||
print "mode should be none, 'menu', 'start', 'reload' or 'stop'."
|
print "mode should be none, 'menu', 'start', 'reload' or 'stop'."
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if service not in ['server', 'portal', 'all']:
|
if service not in ['server', 'portal', 'all']:
|
||||||
print "service should be none, 'server', 'portal' or 'all'."
|
print "service should be none, 'server', 'portal' or 'all'."
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue