-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add autoreload option #778
Comments
This functionality is provided by aiohttp_utils already. Also it's possible to use watchdog (watchmedo) without writing any Python code :) |
As, forgot. There is also |
https://github.com/samuelcolvin/aiohttp_runserver As I just explain on the mailing list I don't think it makes sense to include all the debug paraphernalia in aiohttp itself. Whether it's this library or anther I think the should be a companion tool for aiohttp which help during development. I built |
@samuelcolvin just my two cents, but as someone who recently bet on using aiohttp in production, it would be a huge turn off for me if all of the debug and development tools are scattered around a bunch of small external repositories that may never get maintained. unless it's a single other lib that's officially maintained and has all of the development tools, having a bunch of small libs these small libraries will lead to a typical node/reactjs style bootstrapping nightmare for new adopters. https://twitter.com/thomasfuchs/status/708675139253174273 The batteries included mentality of the python community is what made me choose |
gunicorn --reload does not work immediately. it waits until the next timeout loop. any idea? |
@mshahbazi have a try with aiohttp-devtools, it's still a work in progress but the |
thank you for your reply and thank for the module. it looks great but I had the following problems:
I cannot figure out how does it work.
after installation, I got this error: cannot import name ‘StaticRoute'
I commented out the corresponding lines and still have problem with running my script.
let’s say I should run my script as: “aiohttp-runserver main.py” I get a long chain of errors, starting with:
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/aiohttp_runserver/serve.py", line 240, in import_string
module = import_module(module_path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'main'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/aiohttp/helpers.py", line 454, in log
self.logger.info(self._log_format % tuple(values), extra=extra)
File "/usr/lib/python3.5/logging/__init__.py", line 1279, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python3.5/logging/__init__.py", line 1415, in _log
self.handle(record)
File "/usr/lib/python3.5/logging/__init__.py", line 1425, in handle
self.callHandlers(record)
File "/usr/lib/python3.5/logging/__init__.py", line 1487, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.5/logging/__init__.py", line 855, in handle
self.emit(record)
File "/usr/local/lib/python3.5/dist-packages/aiohttp_runserver/logs.py", line 53, in emit
method, path, _, code, size = msg.split(' ')
ValueError: too many values to unpack (expected 5)
During handling of the above exception, another exception occurred:
…
to keep it simple, main.py holds the following codes only:
app = aiohttp.web.Application()
aiohttp.web.run_app(app=app, host=config.SERVER_HOST, port=config.SERVER_PORT, shutdown_timeout=1)
… On Nov 28, 2016, at 2:21 PM, Samuel Colvin ***@***.***> wrote:
Have a try with aiohttp-devtools <https://github.com/samuelcolvin/aiohttp-devtools>, it's still a work in progress but the runserver command is working well and has autoreload by default.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#778 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AGNhsGkbkPZuB1dKf6WbcNv1XK_eG2fzks5rCrI1gaJpZM4HZ5MC>.
|
Hi @mshahbazi happy to help but please repost the question over on https://github.com/samuelcolvin/aiohttp-devtools to avoid even more confusion. A few more details like OS and aiohttp version would be helpful too. |
For me https://github.com/samuelcolvin/aiohttp-devtools is ready for use so this can be closed. |
closing in favor of https://github.com/samuelcolvin/aiohttp-devtools |
One of the most requested features is autoreloading aiohttp server on source file changes.
I never use the feature at all and don't have a strong personal feeling for adding it.
It may have negative effects by abnormal breaking opened connections (e.g. websockets) also.
But I see to many requests for the feature over internet for last months, so we need to implement it.
It's a easy task though.
The text was updated successfully, but these errors were encountered: