django-commands

Why is run called twice in the Django dev server?

心不动则不痛 提交于 2019-11-27 02:24:31
问题 I want to make the Django development server do something before it starts running. To do this, I created a new app, added it to the top of INSTALLED_APPS , and then created a management/commands/runserver.py file in the app with the following code: from django.contrib.staticfiles.management.commands.runserver import Command as RunserverCommand class Command(RunserverCommand): def run(self, *args, **options): self.stdout.write('About to start running on ' + self.addr) super(Command, self).run