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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:41:27+00:00 2026-06-08T14:41:27+00:00

When I visit /admin/newpost I expect my edit.html template to render and diplay my

  • 0

When I visit /admin/newpost I expect my edit.html template to render and diplay my form fields. Instead, I get a blank page with no error. However, when I view source I see the following.

<Template '/edit.html'>

I don’t get any errors so there is not stack track.

  • GAE Version: 1.7
  • Windows 7 64 bit
  • jinja2 version latest
  • python 2.7

My code and template are below

Here is my code:

import os
import webapp2
import config
import jinja2


from google.appengine.ext import db

import fix_path
import config
import static
import wtforms
from wtforms.ext.appengine.db import model_form
from wtforms import Form, TextField, validators


def render_template(template_name, template_vals=None, theme=None):
    template_path = os.path.join(os.path.dirname(__file__) , \
            "themes", theme or config.theme)
    env = jinja2.Environment(
        loader=jinja2.FileSystemLoader(template_path))
    return env.get_template(template_name, template_vals or {})


class BlogPost(db.Model):
    #The URL path to the blog post. Posts have a path if they are published.
    path = db.StringProperty()
    title = db.StringProperty(required=True, indexed=False)
    body = db.TextProperty(required=True)
    published = db.DateTimeProperty(auto_now_add=True)
    updated = db.DateTimeProperty(auto_now=True)

    def render(self):
        template_vals = {
            'config': config,
            'post': self,
        }
        return render_template("post.html", template_vals)

form = model_form(BlogPost, Form)

class PostForm(form):
    pass

class PostHandler(webapp2.RequestHandler):

    @webapp2.cached_property
    def jinja2(self):
        return jinja2.get_jinja2(app=self.app)

    def render_to_response(
        self,
        template_name,
        template_vals=None,
        theme=None
        ):
        template_name = "admin/%s" % template_name
        self.response.out.write(render_template(
            template_name, template_vals, theme))

    def render_form(self, form):
        self.render_to_response("edit.html", {'form': form})

    def get(self):
        self.render_form(PostForm())

app = webapp2.WSGIApplication([('/admin/newpost', PostHandler)],
                              debug=True)

Here is my template:

{% extends "base.html" %}
{% block title %}Testing New Post Template{% endblock %}
{% block body %}
  <form method="post" action="">
    <table>

<div>{{ form.title.label }}: {{ form.title(class="css_class") }}</div>
{% if form.title.errors %}
        <ul class="errors">{% for error in form.name.errors %}<li>{{ error }}</li>{% endfor %}</ul>
    {% endif %}

<div>{{ form.body.label }}: {{ form.body() }}</div>
{% if form.body.errors %}
        <ul class="errors">{% for error in form.body.errors %}<li>{{ error }}</li>{% endfor %}</ul>
    {% endif %}

    </table>
    <input type="submit" />
  </form>
{% endblock %}

My app.yaml file

application: cmwo-blog
version: 1
runtime: python27
api_version: 1
threadsafe: no

handlers:

- url: /admin/.*
  script: admin.app
  login: admin

- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: /static/([^/]+)/(.*)
  static_files: themes/\1/static/\2
  upload: themes/[^/]+/static/.*

- url: .*
  script: static.app

builtins:
- remote_api: on

libraries:
- name: webapp2
  version: "2.5.1"

- name: jinja2
  version: latest
  • 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-08T14:41:28+00:00Added an answer on June 8, 2026 at 2:41 pm

    I don’t use Jinja, but your render_template method doesn’t seem to be actually rendering the template. It calls env.get_template, which presumably gets a template object, but then needs to call something to actually render that template – looking quickly at the documentation, you should do this:

    template = env.get_template(template_name)
    return template.render(**(template_vals or {}))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I visit the path for an uploaded image in the admin, I get
I get a this eror when visit the url http://localhost:3000/admin/login : ActionController::RoutingError in Admin/login#index
Please visit http://domenadesign.com/istra-bike.com with Firefox browser! After a few clicks on the links page
Please visit this link Click on first Image. Now is showing the Modal page
When I visit the page with the browser it is xml but when I
I want to visit a page like... http://mysitelocaltion/user_name/user_id This is just a virtual link,
i need to visit 50+ page example $page =1 $page =51 $page =101 $page
Assume a simple aspx data entry page in which admin user can upload an
I've been getting this error: The requested admin page does not exist. I've got
ive successfully deployed admin_data onto heroku. i can visit myapp.herokuapp.com/admin_data and the admin_data page

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.