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 7603863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:45:41+00:00 2026-05-30T23:45:41+00:00

I have a question on template render in GAE. I would like to import

  • 0

I have a question on template render in GAE. I would like to import a text file and write it to a html file. In this text file, I have used html symbols to tag new lines new paragraphs. It worked well with webapp. However, the same expression does not work with webapp2. So please give me some suggestions.

Thank you!

    import webapp2        
    text_file2 = open('text1.txt','r')
    x = text_file2.read()  
    html = html + template.render(templatepath + 'A.html', {'model_attributes':'Overview','text_paragraph':x})
  • 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-05-30T23:45:42+00:00Added an answer on May 30, 2026 at 11:45 pm

    I don’t believe that the problem is webapp2 as much as it is Django 1.2, which is, I believe, the default version that you get with GAE as of a recent release of the SDK. The Django 1.2 templating engine differs from the 0.96 version in that it automatically HTML-escapes the content of template variables, and that is probably changing what you expect to see in your render page.

    To fix it, you should add the |safe filter to the variable substitution in your template. So, if your template has something like this:

    {{ text_paragraph }}

    it should look like this:

    {{ text_paragraph|safe }}

    You can find out more information about this, including more options for dealing with Django’s HTML-escaping here

    And here is the official Django documentation on the safe filter.

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

Sidebar

Related Questions

Absolute beginner question: I have a template file index.html that looks like this: ...
I have question concerning a function I created. I would like to show the
I have asked a question about how to avoiding to write the html in
I've used this question as a template to solve the same problem, but I'm
I have a basic question, in the Django template language how can you tell
I know this question will sound like a from the past thing but I
I have a question about splitting up a main.py file. right now, I have
This question relates to Django Aggregation/Annotation in 1.1. Suppose I have a simple model
This is a running question that I have updated to hopefully be a little
This is a generalization of my previous question about pluralize filter: Does lift have

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.