← Back to team overview

graphite-dev team mailing list archive

[Merge] lp:~don-jones/graphite/option-noreload into lp:graphite

 

Don Jones has proposed merging lp:~don-jones/graphite/option-noreload into lp:graphite.

Requested reviews:
  graphite-dev (graphite-dev)

For more details, see:
https://code.launchpad.net/~don-jones/graphite/option-noreload/+merge/93377

Allow option `--noreload` for run-graphite-devel-server.py which is passed to django-admin.py

Use `os.execvp` instead of `os.system` to allow better control of django.
To be able to cleanly shutdown django in a development or integration environment pass --noreload to run-graphite-devel-server.py to prevent django-admin from forking.
-- 
https://code.launchpad.net/~don-jones/graphite/option-noreload/+merge/93377
Your team graphite-dev is requested to review the proposed merge of lp:~don-jones/graphite/option-noreload into lp:graphite.
=== modified file 'bin/run-graphite-devel-server.py'
--- bin/run-graphite-devel-server.py	2009-09-14 21:40:04 +0000
+++ bin/run-graphite-devel-server.py	2012-02-16 11:14:29 +0000
@@ -8,6 +8,7 @@
 ''')
 option_parser.add_option('--port', default=8080, action='store', type=int, help='Port to listen on')
 option_parser.add_option('--libs', default=None, help='Path to the directory containing the graphite python package')
+option_parser.add_option('--noreload', action='store_true', help='Disable monitoring for changes')
 
 (options, args) = option_parser.parse_args()
 
@@ -34,7 +35,16 @@
 
 print "Running Graphite from %s under django development server\n" % graphite_root
 
-command = "%s runserver --pythonpath=%s --settings=graphite.settings 0.0.0.0:%d" % (django_admin, python_path, options.port)
-
-print command
-sys.exit( os.system(command) >> 8 )
+command = [
+  django_admin,
+  'runserver',
+  '--pythonpath', python_path,
+  '--settings', 'graphite.settings',
+  '0.0.0.0:%d' % options.port
+]
+
+if options.noreload:
+  command.append('--noreload')
+
+print ' '.join(command)
+os.execvp(django_admin, command)