Skip to content

Development server

Reload dev server on component file changesยค

This is relevant if you are using the project structure as shown in our examples, where HTML, JS, CSS and Python are in separate files and nested in a directory.

sampleproject/
โ”œโ”€โ”€ components/
โ”‚   โ””โ”€โ”€ calendar/
โ”‚       โ”œโ”€โ”€ calendar.py
โ”‚       โ””โ”€โ”€ calendar.html
โ”‚       โ””โ”€โ”€ calendar.css
โ”‚       โ””โ”€โ”€ calendar.js
โ”œโ”€โ”€ sampleproject/
โ”œโ”€โ”€ manage.py
โ””โ”€โ”€ requirements.txt

In this case you may notice that when you are running a development server, the server sometimes does not reload when you change component files.

From relevant StackOverflow thread:

TL;DR is that the server won't reload if it thinks the changed file is in a templates directory, or in a nested sub directory of a templates directory. This is by design.

To make the dev server reload on all component files, set reload_on_file_change to True. This configures Django to watch for component files too.

Warning

This setting should be enabled only for the dev environment!