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

  • Home
  • SEARCH
  • 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 8109649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:29:14+00:00 2026-06-06T01:29:14+00:00

I am working on getting Jinja2 to work with Google AppEngine. I have the

  • 0

I am working on getting Jinja2 to work with Google AppEngine. I have the following for my main.py code:

import os
import webapp2
import jinja2

jinja_environment = jinja2.Environment(autoescape=True, 
    loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')))

class MainPage(webapp2.RequestHandler):
    def get(self):
        template_values = {
            'name': 'SomeGuy',
            'verb': 'extremely enjoy'
        }

    template = jinja_environment.get_template('index.html')
    self.response.out.write(template.render(template_values))

webapp2.WSGIApplication([('/', MainPage)], debug=True)

This has been killing me for hours I would be grateful for some help.

UPDATE:

I have changed the code a bit to update the situation. The logs are telling me:

ImportError: <module 'main' from '/base/data/home/apps/s~devpcg/1.359633215335673018/main.pyc'> has no attribute app

and the above code is all from my main.py folder. I have a file index.html in a folder called templates that is in the same directory as the main.py file.

  • 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-06T01:29:15+00:00Added an answer on June 6, 2026 at 1:29 am

    I was not sure if this is a copy-paste error when pasting your code over to stackoverflow, but you do seem to be getting an indentation error as indicated in the comments…
    This is the correct indentation:

    class MainPage(webapp2.RequestHandler):
        def get(self):
            template_values = {
                'name': 'SomeGuy',
                'verb': 'extremely enjoy'
            }
    
            template = jinja_environment.get_template('index.html')
            self.response.out.write(template.render(template_values))
    

    Edit:
    Based on the new error I would recommend you give a little bit more information about how your application is structured.
    I am guessing that you are showing us your main.py file.
    If that is indeed the case you need to have something like the code below in that file (assuming Python 2.7).
    For more-granular details please refer to the documentation:
    https://developers.google.com/appengine/docs/python/python27/using27#Configure_WSGI_Script_Handlers

    app = webapp2.WSGIApplication(routes=[ 
        ( r'/', MainPage ),
        # ... other paths ...
    ], debug=True) # True for now until ready for prod...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on getting a mail app to work from a tutorial
I have been working on getting a python CGI script to work all day,
Following on from my previous question I have been working on getting my object
I have a legacy database that I'm working on getting ActiveRecord to work with.
I'm working on getting (JavaScript) scripting to work in Java. I have a program
I have been working on getting this seat mapping chart for a while and
I am working on getting familiar with the Android SDK and I have having
I'm working on getting FluentValidation working with Castle Windsor. I already have a wrapper
I am working on getting lucene indexing working on Google App Engine. I am
I'm just working on getting at samples for processing from the microphone. I 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.