Permalink
Browse files

Implementation called django-admin.py

  • Loading branch information...
1 parent 7a5359d commit 0c7a204028cf0ba58e5fa8040496ef294a9ed92a @dongweiming dongweiming committed Feb 12, 2014
Showing with 5 additions and 15 deletions.
  1. +5 −15 bin/run-graphite-devel-server.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python
import sys, os
-import subprocess
from optparse import OptionParser
+from django.core import management
+
option_parser = OptionParser(usage='''
%prog [options] GRAPHITE_ROOT
''')
@@ -20,18 +21,6 @@
graphite_root = args[0]
-django_admin = None
-for name in ('django-admin', 'django-admin.py'):
- process = subprocess.Popen(['which', name], stdout=subprocess.PIPE)
- output = process.stdout.read().strip()
- if process.wait() == 0:
- django_admin = output
- break
-
-if not django_admin:
- print "Could not find a django-admin script!"
- sys.exit(1)
-
python_path = os.path.join(graphite_root, 'webapp')
if options.libs:
@@ -42,7 +31,7 @@
print "Running Graphite from %s under django development server\n" % graphite_root
command = [
- django_admin,
+ 'django-admin.py',
'runserver',
'--pythonpath', python_path,
'--settings', 'graphite.settings',
@@ -53,4 +42,5 @@
command.append('--noreload')
print ' '.join(command)
-os.execvp(django_admin, command)
+
+management.execute_from_command_line(command)

0 comments on commit 0c7a204

Please sign in to comment.