Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:23:08+00:00 2026-06-18T00:23:08+00:00

I am using django 1.4. I am moving codes from tornado to django. There

  • 0

I am using django 1.4. I am moving codes from tornado to django. There is self.write() at the end of a class. What ‘s the alternative solution to self.write()? HttpResponse? There is only one template page
so Do I need to response to other page? can I just call response? or render_to_response to the template page again to wrape data to the page? Is write() same with HttpResponse()?
Hey, guys. there are many “?” above, But I only have one problem. An alternative solution of tornado’s “write()” in django.
thx for ur time.

The code in tornado looks like:

class DataHandler(tornado.web.RequestHandler):
    ...
    val = ...
    self.write(val)

Maybe in django?

def DataHandler(request):
    ...
    val = ...
    return HttpResponse(val)

Is that clear about my question?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:23:09+00:00Added an answer on June 18, 2026 at 12:23 am

    HttpResponse is typically used if you wish to return non-template responses.

    To render templates, use render from django.shortcuts, for example:

    from django.shortcuts import render
    
    def some_handler(request):
        context_for_template = {}
        return render(request, 'template_name.html', context_for_template)
    

    From Tornado’s documentation, write seems to be able to automatically convert a dictionary to JSON. HttpResponse does not do that by default, you should look at Creating a JSON response using Django and Python if it is part of your use case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using django-contact-form , I have overridden the form class: from contact_form.forms import ContactForm from
Using django comments framework http://docs.djangoproject.com/en/dev/ref/contrib/comments/ Not sure is there option, to make all comments
Using Django 1.1, I am trying to select the maximum value from a varchar
Am using django social-auth authentication for my app.After login to facebook or twitter from
Using django-social-auth to grab user data from facebook, it is returning a list of
Using Django 1.1.1 In models.py: class Site(models.Model): name = models.CharField(max_length=50) class SiteMonth(models.Model): site =
(Using django as an example; the ForeignKey is implicit in the example) >>> from
Using django, I'm trying to get a QuerySet of FK relationships from another QuerySet.
Using django-south, is it possible to setup a table only to the last, most
When using django.contrib.comments is there anyway to add the reverse relationship to a model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.