Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork371
html template reloading#32
-
Great work on this Nick. I just want to check if my understanding of html template reloading is correct. With the normal django development server, setting the However with gunicorn as the server, this does not work.
Is this the expected behaviour or am I doing something wrong? The only way I've managed to get templates to reload is by adding the following to
And so, to get the browser to load changes to any template file, I would either have to explicitly list those templates in There is apull request for gunicorn that would make this simpler, but unfortunately it has been sitting unmerged for 4 years. Is there a better way? |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 2 comments 3 replies
-
Hi, We pass our app into gunicorn and then gunicorn is configured with:
That should handle all reloading by itself. It does for this example app which has a custom |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thanks for the quick reply. I did see that setting, however for me changes to the templates to not appear in the browser after reload. I've just cloned the repository and checked this in the pages app. Two things suggested to me that we shouldn't expect the reload to work:
But again I'm not certain if this is the case or if the templates should reload on change and there is something wrong with my setup. Have you been able to confirm the template reloading works recently? Edit So I'm developing on Ubuntu 22.04 on WSL2 on Windows 11. If I try to edit a template from WSL then as I wrote above the templates do not reload. However, if I edit inside adevcontainer i.e. insider the docker container itself, the change is detected and gunicorn reloads so I guess in my setup, gunicorn is not seeing the file system changes originating from the WSL bind mount. In any case, I like to develop inside the devcontainer so its not an issue for me. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I'm using Ubuntu 22.04 and WSL 2 too, but on Windows 10. Are your files in your WSL 2 file system? I think it might not work if your files are in a Windows drive that you're mounting into WSL 2. In my case my files are in WSL 2's file system. |
BetaWas this translation helpful?Give feedback.
All reactions
-
The files are in the WSL2 file system. Looking atone of the old issue threads which looks similar, it could be that I'm using neovim and running into the same issue which that affected user identified. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
It's possible but that would potentially only apply to CSS files due to a bug in Tailwind and you mentioned Django templates were causing an issue with not being reloaded. It's worth a shot delving down that rabbit hole tho or at least seeing if it happens with other editors as a quick test. I use Vim too btw. My vimrc is at:https://github.com/nickjj/dotfiles/blob/master/.vimrc |
BetaWas this translation helpful?Give feedback.