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

auto reload LocalDevServer on module change #316

Closed
aldegoeij opened this issue Apr 28, 2017 · 10 comments
Closed

auto reload LocalDevServer on module change #316

aldegoeij opened this issue Apr 28, 2017 · 10 comments

Comments

@aldegoeij
Copy link

Hello guys! Love the work on Chalice, makes life with API Gateway much easier.

What framework do you use for the LocalDevServer? Currently it does not auto reload on a change (save) of a module under development, which slows down development quite a bit.

Are you using bare BaseHTTPServer only? Is it easy to implement a reloader?

@jamesls
Copy link
Member

jamesls commented Apr 28, 2017

We're using BaseHTTPServer. It should be possible to implement a reloader, not sure on how easy it would be, but I think it would be useful to have. Marking as feature request.

@Marcelo-Theodoro
Copy link

+1.

It's easy to look for changed files using os.static and checking the st_mtime attribute. Like werkzeug[1]. The checking could be done in the LocalDevServer.serve_forever but instead of using the HTTPServer.serve_forever, the LocalDevServer.serve_forever would use the HTTPServer.handle_request inside a loop. Would this change have bad implications?

However I'm not sure of how to reload the application itself when we detect that a file changed. Just re-import everything?

[1] https://github.com/pallets/werkzeug/blob/368ccb07d097660156eb19a0ec2042bc53e68238/werkzeug/_reloader.py#L137

@tzookb
Copy link

tzookb commented Nov 20, 2017

wish I wasnt a python newb and could have helped with this :/

@rapidoo
Copy link

rapidoo commented Nov 23, 2017

+1

@mlecoq
Copy link

mlecoq commented Jan 23, 2018

+1

@marcmillien
Copy link

marcmillien commented Feb 1, 2018

While waiting for the feature, you can use watchdog and the command watchmedo:

watchmedo \
  auto-restart \
  --patterns="*.py" \
  --ignore-directories \
  --recursive \
  -- chalice local

Or other equivalents 😁 .

@trickidicki
Copy link

@marcmillien Alas watchmedo auto-restart doesn't work on Windows...
gorakhargosh/watchdog#387
:-((

@juliensimon
Copy link

+1, would love to have this.

@cdalar
Copy link

cdalar commented May 9, 2018

+1

@jamesls
Copy link
Member

jamesls commented May 21, 2018

Implemented in #846. This will go out in the next release.

@jamesls jamesls closed this as completed May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants