Comments (19)
What is the current preferred way of auto reloading during development?
from daphne.
There are several reasons:
- Runserver is very limited, as soon as you have a more demanding web application (for example, one that requires parallel requests) it's not suitable anymore
- To reduce complexity and to make sure everything works similarly on production and development I run gunicorn on both with a single ansible deploy configuration. The only difference is that development has
DEBUG
enabled.
I agree with your statement that runserver = development but I disagree with runworker = production. While runworker can be used in production it can be used in development as well similarly to how gunicorn and celery can be used both in production and in development environments.
Luckily your environment is simple enough not to require anything outside the scope of runserver but that isn't to say everyone has that luxury.
from daphne.
@wolph OK, thanks... — not quite sure how helpful that's meant to be. Uvicorn is great. Glad you're having fun with that.
I understand it's not nice to hear but I could have implemented this years ago when Daphne was the only solution. Apparently there are alternative asgi servers these days which I wasn't aware of when I commented earlier.
So while it's perhaps not useful for you, it's useful for others that are faced with this problem. At the very least until this feature is implemented.
If you have a compelling reason to prefer Daphne over some of the other servers, please let me know. I couldn't immediately see any benefit but I'm not invested in any of the solutions so I'm open to suggestions and might even implement this feature if there is a point to it.
from daphne.
Hi guys, is this still an open issue as of now ?
from daphne.
A nice alternative for Daphne that does support reloading is Uvicorn btw: https://www.uvicorn.org/
from daphne.
It would be nice for sure, but it's tricky to get right; the runserver
implementation uses the Django auto-reload code which is a) already existing and tested and b) basically unchanged since 2007
Thus, re-implementing it is not the easiest. But, it would be nice, so I'll leave this open in the hope we get to it in the future.
from daphne.
True. The implementation should definitely borrow from one of the other
frameworks to reduce errors. For the time being I'll work around the
problem.
On a different note, is there a way to get Daphne running with nginx as a
proxy? I'm just starting with channels so it might be the rest of the code
but I can't seem to get a working response yet.
On May 5, 2016 02:23, "Andrew Godwin" [email protected] wrote:
It would be nice for sure, but it's tricky to get right; the runserver
implementation uses the Django auto-reload code which is a) already
existing and tested and b) basically unchanged since 2007Thus, re-implementing it is not the easiest. But, it would be nice, so
I'll leave this open in the hope we get to it in the future.—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)
from daphne.
Twisted has an issue with this because it needs to have the main thread/other reasons, see http://webcache.googleusercontent.com/search?q=cache:1yO9OJVnqVcJ:blog.elsdoerfer.name/2010/03/09/twisted-twistd-autoreload/+&cd=2&hl=en&ct=clnk&gl=us&client=firefox-b-ab for some details about how this works.
from daphne.
@hawkowl Autoreload is actually enabled with runserver
under a subthread; it has to have its signal handling turned off though, as that's the part of Twisted that seemed to want main thread access.
from daphne.
It has been pointed out to me that autoreload outside the context of runserver makes no sense as Daphne does not actually host any user code, so closing this as WONTFIX.
from daphne.
You import the channel layer, do you not? If so, than please clarify why auto reloading would make no sense?
from daphne.
Why would you possibly need to auto reload outside of runserver? runserver = development, runworker = production. Personally, I was super happy to realize that thanks to channels I can now easily debug websockets.
As, for Nginx: http://nginx.org/en/docs/http/websocket.html
from daphne.
I might agree with adding autoreload to runworker
as an off-by-default option, but adding it to Daphne makes no sense, as the only thing you would need to reload for was if your CHANNEL_LAYER settings changed. You can run Daphne without even importing Django or your project at all if you set up a channel layer separately.
from daphne.
2020 30 June still not any updates?
from daphne.
This issue was closed as wontfix in 2016. Unless there's some case for re-opening there will not be any updates.
from daphne.
@carltongibson the original case for this is still valid and @andrewgodwin never responded to why it would make no sense to implement
from daphne.
If you want to do a proof of concept, using say watchgod like uvicorn, I’m happy to have a look at it!
from daphne.
@wolph OK, thanks... — not quite sure how helpful that's meant to be. Uvicorn is great. Glad you're having fun with that.
from daphne.
@kiruh I switched to Uvicorn as recommended by @wolph.
from daphne.
Related Issues (20)
- how to set websocket send buffersize in daphne
- issuse when i using daphe in my django app with streaminghttpresponse HOT 7
- Can daphne run WSGI apps? HOT 6
- Does daphne have a file for initialization?
- Requests with Transfer-Encoding: chunked have no content HOT 14
- StreamHttpResponse with sync operations break in Daphne HOT 5
- Memory usage: Daphne loading all the file in memory (POST request) HOT 7
- Text streaming buffered issue
- Implement WebSocket Denial Response extension HOT 8
- [feature request] trailing headers HOT 1
- Add support for Python 3.12
- DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 HOT 1
- Daphne with self signed ssl HOT 2
- Daphne allows invalid characters within header names HOT 5
- Unix File Socket Argument HOT 12
- TypeError: object HttpResponse can't be used in 'await' expression HOT 3
- add support for --proxy-headers and friends in runserver HOT 4
- fd_endpoint.py is not properly installed HOT 7
- python manage.py runserver not working HOT 5
- Daphne - Twisted custom cipher list using set_cipher method HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from daphne.