Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is StatReloader while running Django?

Tags:

django

I've just created new Python 3.7 virtualenv with Django 2.2

And each runserver it prints:

Watching for file changes with StatReloader

I could not find any info in Django's docs etc.

Is it related specially to Django somehow? Does it go with Django? What it does? Why is it printed in red in PyCharm? Should I be careful about something? Could it be disabled?

Big thx

like image 355
MaxCore Avatar asked Apr 24 '19 13:04

MaxCore


2 Answers

Its the class that django uses to auto reload the development server whenever you make code changes .

Specifically, determined within the get_reloader method where watchman is an alternative for linux / macOS

If you’re using Linux or MacOS and install both pywatchman and the Watchman service, kernel signals will be used to autoreload the server (rather than polling file modification timestamps each second). This offers better performance on large projects, reduced response time after code changes, more robust change detection, and a reduction in power usage.

(Runserver docs)

No idea why its in red in pycharm but if you really wanted to you can disable it with the --noreload flag

like image 187
Sayse Avatar answered Sep 23 '22 04:09

Sayse


in my case, I changed the option DEBUG= True for DEBUG=False in my file settings.py, since then its working.

before in settings.py:

#SECURITY WARNING: don't run with debug turned on in production! DEBUG = True 

in docker :

$ docker run  container_name   Watching for file changes with StatReloader  

after in settings.py:

#SECURITY WARNING: don't run with debug turned on in production! DEBUG = False  

in docker:

$ docker run container_name [24/Mar/2020 10:10:19] "GET /health HTTP/1.1" 200 5299 
like image 33
LEONARDO PEREIRA RODRIGUES Avatar answered Sep 20 '22 04:09

LEONARDO PEREIRA RODRIGUES