django.contrib.staticfiles.management.commands.runserver: 14 total statements, 0.0% covered

Generated: Wed 2013-03-13 10:33 CET

Source file: /media/Envs/Envs/filer-gallery/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/runserver.py

Stats: 0 executed, 10 missed, 4 excluded, 15 ignored

  1. from optparse import make_option
  2. from django.conf import settings
  3. from django.core.management.commands.runserver import BaseRunserverCommand
  4. from django.contrib.staticfiles.handlers import StaticFilesHandler
  5. class Command(BaseRunserverCommand):
  6. option_list = BaseRunserverCommand.option_list + (
  7. make_option('--nostatic', action="store_false", dest='use_static_handler', default=True,
  8. help='Tells Django to NOT automatically serve static files at STATIC_URL.'),
  9. make_option('--insecure', action="store_true", dest='insecure_serving', default=False,
  10. help='Allows serving static files even if DEBUG is False.'),
  11. )
  12. help = "Starts a lightweight Web server for development and also serves static files."
  13. def get_handler(self, *args, **options):
  14. """
  15. Returns the static files serving handler wrapping the default handler,
  16. if static files should be served. Otherwise just returns the default
  17. handler.
  18. """
  19. handler = super(Command, self).get_handler(*args, **options)
  20. use_static_handler = options.get('use_static_handler', True)
  21. insecure_serving = options.get('insecure_serving', False)
  22. if use_static_handler and (settings.DEBUG or insecure_serving):
  23. return StaticFilesHandler(handler)
  24. return handler