-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not attempt to inject HTML into streaming responses
- Loading branch information
Showing
3 changed files
with
37 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
from django.contrib import admin | ||
from django.http import StreamingHttpResponse | ||
from django.template.loader import render_to_string | ||
from django.urls import path | ||
from django.views.generic import TemplateView | ||
|
||
|
||
def streaming_view(request): | ||
content = render_to_string("index.html", request=request) | ||
return StreamingHttpResponse(iter(content), content_type="text/html") | ||
|
||
|
||
urlpatterns = [ | ||
path("admin/", admin.site.urls), | ||
path("", TemplateView.as_view(template_name="index.html")), | ||
path("streaming/", streaming_view), | ||
] |