Merge lp:~dohse/graphite/option-noreload into lp:~graphite-dev/graphite/main

Proposed by Jonas Dohse
Status: Merged
Merged at revision: 689
Proposed branch: lp:~dohse/graphite/option-noreload
Merge into: lp:~graphite-dev/graphite/main
Diff against target: 32 lines (+14/-4)
1 file modified
bin/run-graphite-devel-server.py (+14/-4)
To merge this branch: bzr merge lp:~dohse/graphite/option-noreload
Reviewer Review Type Date Requested Status
Michael Leinartas Approve
Review via email: mp+93377@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Michael Leinartas (mleinartas) wrote :

The changes make sense and test out ok. Looks good, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/run-graphite-devel-server.py'
2--- bin/run-graphite-devel-server.py 2009-09-14 21:40:04 +0000
3+++ bin/run-graphite-devel-server.py 2012-02-16 11:14:29 +0000
4@@ -8,6 +8,7 @@
5 ''')
6 option_parser.add_option('--port', default=8080, action='store', type=int, help='Port to listen on')
7 option_parser.add_option('--libs', default=None, help='Path to the directory containing the graphite python package')
8+option_parser.add_option('--noreload', action='store_true', help='Disable monitoring for changes')
9
10 (options, args) = option_parser.parse_args()
11
12@@ -34,7 +35,16 @@
13
14 print "Running Graphite from %s under django development server\n" % graphite_root
15
16-command = "%s runserver --pythonpath=%s --settings=graphite.settings 0.0.0.0:%d" % (django_admin, python_path, options.port)
17-
18-print command
19-sys.exit( os.system(command) >> 8 )
20+command = [
21+ django_admin,
22+ 'runserver',
23+ '--pythonpath', python_path,
24+ '--settings', 'graphite.settings',
25+ '0.0.0.0:%d' % options.port
26+]
27+
28+if options.noreload:
29+ command.append('--noreload')
30+
31+print ' '.join(command)
32+os.execvp(django_admin, command)

Subscribers

People subscribed via source and target branches