48đź‘Ť
The Problem
Unfortunately, there’s no command-line argument or setting you can just turn on in order to turn off the checks in runserver
. In general, there’s the --skip-checks
option which can turn off system checks but they are of no use for runserver
.
If you read the code of the runserver
command, you see that it essentially ignores the requires_system_checks
and requires_migration_checks
flags but instead explicitly calls self.check()
and self.check_migrations()
in its inner_run
method, no matter what:
def inner_run(self, *args, **options):
[ Earlier irrelevant code omitted ...]
self.stdout.write("Performing system checks...\n\n")
self.check(display_num_errors=True)
# Need to check migrations here, so can't use the
# requires_migrations_check attribute.
self.check_migrations()
[ ... more code ...]
A Solution
What you could do is derive your own run
command, which takes the runserver
command but overrides the methods that perform the checks:
from django.core.management.commands.runserver import Command as RunServer
class Command(RunServer):
def check(self, *args, **kwargs):
self.stdout.write(self.style.WARNING("SKIPPING SYSTEM CHECKS!\n"))
def check_migrations(self, *args, **kwargs):
self.stdout.write(self.style.WARNING("SKIPPING MIGRATION CHECKS!\n"))
You need to put this under <app>/management/commands/run.py
where <app>
is whatever appropriate app should have this command. Then you can invoke it with ./manage.py run
and you’ll get something like:
Performing system checks...
SKIPPING SYSTEM CHECKS!
SKIPPING MIGRATION CHECKS!
January 18, 2017 - 12:18:06
Django version 1.10.2, using settings 'foo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
2đź‘Ť
There’s one thing that might speed up the PyCharm’s debugger and that is to turn off the “Collect run-time types information for code insight” setting :located under File > Settings > Build, Execution, Deployment > Python Debugger.
- [Django]-Django bytesIO to base64 String & return as JSON
- [Django]-Disable HTML escaping in Django's TextField
- [Django]-Specifying a mySQL ENUM in a Django model
1đź‘Ť
I don’t have enough reputation to comment on Louis’ answer, but it is no longer the case as of django 4.0 that runserver
command explicitly calls self.check()
. It now conditionally runs based on the --skip-checks
option.
def inner_run(self, *args, **options):
[ Earlier irrelevant code omitted ...]
if not options["skip_checks"]:
self.stdout.write("Performing system checks...\n\n")
self.check(display_num_errors=True)
# Need to check migrations here, so can't use the
# requires_migrations_check attribute.
self.check_migrations()
[ ... more code ...]
In other words, python manage.py runserver --skip-checks
will skip system checks.
- [Django]-PermissionError: [Errno 13] Permission denied: '/manage.py'
- [Django]-How to include JavaScript in Django Templates?
- [Django]-Django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment varia