Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Django Browser Reload instead a Javascript based one for auto reload #3745

Open
Benoss opened this issue Jun 8, 2022 · 5 comments · May be fixed by #3750
Open

Use Django Browser Reload instead a Javascript based one for auto reload #3745

Benoss opened this issue Jun 8, 2022 · 5 comments · May be fixed by #3750

Comments

@Benoss
Copy link

Benoss commented Jun 8, 2022

Description

For a long time I used gulp and JS based BrowserReload to auto reload when a change is made in CSS/JS.
Recently I converted my projects to use https://github.com/adamchainz/django-browser-reload

Rationale

  • It makes sense to use a Python based browser reloader as it should be compatible with all frontend pipelines.
  • Reduce the javascript dependencies and the complexity of the gulp file
  • django-browser-reload fixes some of the issues I had with the JS one. Multi tab, reload concurrency
  • django-browser-reload is made for django by django people and my experience with it has been extremely smooth
@Andrew-Chen-Wang
Copy link
Contributor

this is really cool! Not sure if it would be too dev opinionated, but I +1 it

@browniebroke
Copy link
Member

Nice suggestion, the rationale makes a lot of sense. I would be interested to see what such change would look like, especially with the Docker setup.

@Benoss
Copy link
Author

Benoss commented Jun 9, 2022

Not sure what are the current issues with the Docker setup (I am using a local setup) but django-browser-reload should just work.
It is using django.http.StreamingHttpResponse under the hood to push state back to the browser and reload the tab this means that's the same webserver than the one serving your we pages. If you can see a page then you should be able to reload it.
The install is not more difficult than Django debug toolbar. I haven't tested with Django Compressor but it should also work out of the box.

@browniebroke
Copy link
Member

Not sure what are the current issues with the Docker setup

It's not so much of any specific issues. In my experience, these types of auto-reload sometimes rely on some extra connections that can be blocked from within the container. May or may not be an issue here, just something to watch out for I guess.

I'm open to review a pull request with such change, would you like to work on this? If you can port what you did so far, we can then assess whether Docker is actually a problem or not.

@Benoss Benoss linked a pull request Jun 12, 2022 that will close this issue
2 tasks
@Benoss
Copy link
Author

Benoss commented Jun 12, 2022

@browniebroke I have created a pull request, did a bit of manual testing and it is CI valid. There is no way to auto test this, would be keen for people to test what they usually do when they start a project and check if the reload is working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants