Commits

Xianyi Lin committed 9c31e35

Added the -c shortcut for --clear_datastore.
Cleanup of hardcoding of progname in runserver.

Comments (0)

Files changed (1)

management/commands/runserver.py

         make_option('--debug_imports', action='store_true', default=False,
             help='Prints debugging messages related to importing modules, including \
                 search paths and errors.'),
-        make_option('--clear_datastore', action='store_true', default=False,
+        make_option('-c', '--clear_datastore', action='store_true', default=False,
             help='Clears the datastore data and history files before starting the web server.'),
         make_option('--require_indexes', action='store_true', default=False,
             help="""Disables automatic generation of entries in the index.yaml file. Instead, when
         sys.modules['__main__'] = dev_appserver_main
         return super(Command, self).create_parser(prog_name, subcommand)
 
+    def run_from_argv(self, argv):
+        """
+        Captures the program name, usually "manage.py"
+        """
+
+        self.progname = argv[0]
+        super(Command, self).run_from_argv(argv)
+
     def run(self, *args, **options):
         """
         Starts the App Engine dev_appserver program for the Django project.
         if self.port:
             args.extend(["--port", self.port])
 
-        #progname = argv[0]
-        progname = "manage.py" # TODO: need to find a way to properly pass this here
-
         # Add email settings
         from django.conf import settings
         if not options.get('smtp_host', None) and not options.get('enable_sendmail', None):
         logging.getLogger().setLevel(logging.INFO)
 
         # Append the current working directory to the arguments.
-        dev_appserver_main.main([progname] + args + [PROJECT_DIR])
+        dev_appserver_main.main([self.progname] + args + [PROJECT_DIR])