#19126: runserver versus model validation
-------------------------------------+-------------------------------------
     Reporter:  direvus              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Management     |                  Version:  1.3
  commands)                          |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

 * stage:  Design decision needed => Accepted


Comment:

 runserver currently contains this code:

 {{{
     # Validatioisn  called explicitly each time the server is reloaded.
     requires_model_validation = False
 }}}

 I propose to change this to `True`, and take it into account in
 `inner_run`.

 Untested patch:

 {{{
 --- a/django/core/management/commands/runserver.py
 +++ b/django/core/management/commands/runserver.py
 @@ -30,9 +30,6 @@ class Command(BaseCommand):
      help = "Starts a lightweight Web server for development."
      args = '[optional port number, or ipaddr:port]'

 -    # Validation is called explicitly each time the server is reloaded.
 -    requires_model_validation = False
 -
      def get_handler(self, *args, **options):
          """
          Returns the default WSGI handler for the runner.
 @@ -89,7 +86,8 @@ class Command(BaseCommand):
          quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or
 'CONTROL-C'

          self.stdout.write("Validating models...\n\n")
 -        self.validate(display_num_errors=True)
 +        if self.requires_model_validation:
 +            self.validate(display_num_errors=True)
          self.stdout.write((
              "%(started_at)s\n"
              "Django version %(version)s, using settings %(settings)r\n"
 }}}

 That would make it trivial to disable model validation when needed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19126#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to