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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:17:28+00:00 2026-06-17T16:17:28+00:00

In my project (using Python, Html & Jinja2) I have a home_page with movie

  • 0

In my project (using Python, Html & Jinja2) I have a home_page with movie pictures that each picture leads to a specific page with the movie data. When I try to present the page with the movie data I’m getting the following error:

Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line  
1536, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 
1530, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 
1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 
1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 572,  
in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 570, 
in dispatch
return method(*args, **kwargs)
File "C:\Users\User\Desktop\imovie-good\main.py", line 67, in get
movie_data = db.get(self.request.get('movie_key'))
File "C:\Program Files 
(x86)\Google\google_appengine\google\appengine\ext\db\__init__.py", line 1537, in get
return get_async(keys, **kwargs).get_result()
File "C:\Program Files 
(x86)\Google\google_appengine\google\appengine\ext\db\__init__.py", line 1496, in 
get_async
keys, multiple = datastore.NormalizeAndTypeCheckKeys(keys)
File "C:\Program Files   
(x86)\Google\google_appengine\google\appengine\api\datastore.py", line 178, in   
NormalizeAndTypeCheckKeys
keys = [_GetCompleteKeyOrError(key) for key in keys]
File "C:\Program Files 
(x86)\Google\google_appengine\google\appengine\api\datastore.py", line 2739, in 
_GetCompleteKeyOrError
key = Key(arg)
File "C:\Program Files 
(x86)\Google\google_appengine\google\appengine\api\datastore_types.py", line 378, in  
__init__
raise datastore_errors.BadKeyError('Invalid string key %s.' % encoded)
BadKeyError: Invalid string key .

This is my python code:

    import webapp2
    import jinja2
    import os
    import datetime
    import time
    import cgi
    from google.appengine.ext import db
    from google.appengine.api import users
    from google.appengine.api import images


    jinja_environment = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))

    class Movie(db.Model):
        name = db.StringProperty()
        release_date = db.StringProperty()
        duration = db.StringProperty()
        director = db.StringProperty()
        actors = db.StringProperty(multiline=True)
        summary = db.StringProperty(multiline=True)
        picture = db.BlobProperty()
        trailer = db.StringProperty(multiline=True)
        date = db.DateTimeProperty(auto_now_add=True)

    class Movie_Data(webapp2.RequestHandler):
        def get(self):
            movie_key = self.request.get('movie_key')
            movie_data = Movie.get(movie_key)

    template_values = {'movie_data': movie_data}
            template = jinja_environment.get_template('movie_data.html')
            self.response.out.write(template.render(template_values))

    class Image(webapp2.RequestHandler):
        def get(self):
            movie = db.get(self.request.get('img_id'))
            if movie.picture:
                self.response.headers['Content-Type'] = 'image/jpeg'
                self.response.out.write(movie.picture)
            else:
                self.response.out.write("No Image")

    class Main(webapp2.RequestHandler):
        def get(self):
            movies = db.GqlQuery("SELECT * "
                                "FROM Movie "
                                "ORDER BY release_date DESC LIMIT 5")
            template_values = { 'movies': movies}                                   
            template = jinja_environment.get_template('home_page.html')
            self.response.out.write(template.render(template_values))

    class Admin(webapp2.RequestHandler):
        def get(self):
            template_values = {}
            template = jinja_environment.get_template('admin.html')
            self.response.out.write(template.render(template_values))


        def post(self):
            name = self.request.get('name')
            release_date = self.request.get('release_date')
            c = time.strptime(release_date,"%m/%d/%Y")
            release_date = time.strftime("%m%d%Y",c)
            duration = self.request.get('duration')
            director = self.request.get('director')
            actors = self.request.get('actors')
            summary = self.request.get('summary')
            picture = self.request.get('img')
            trailer = self.request.get('trailer')

            movie = Movie(key_name = name)
            movie.release_date = release_date
            movie.duration = duration
            movie.director = director
            movie.actors = actors
            movie.summary = summary
            movie.picture = db.Blob(picture)
            movie.trailer = trailer
            movie.put()
            self.redirect('/')



    app = webapp2.WSGIApplication([('/admin', Admin), ('/', Main), ('/img', Image), ('/movie_data', Movie_Data)], debug=True)

This is my html for the home_page:

    <html>
    <body>
        <table>
            <th>Top Movies</th>

            {% for movie in movies %}
            <tr>
                <td>{{movie.key().name() }} &nbsp</td>
            </tr>
            <tr>
                <td><a href = "/movie_data?movie_key = {{movie.key()}}"> <img src = "/img?img_id={{movie.key()}}"> </td>


            </tr>

            {% endfor %}

            <a href = "/admin">admin</a>

        </table>
    </body>
</html>

This is my movie_data html code:

  <html>
    <body>
        <div>
            <table>
                <tr>
                    <td rowspan ="6">{{ movie_data.picture }}</td>
                    <td> Movie Name: {{movie_data.name}}</td> 
                </tr>
                <tr>
                    <td> Release Date: {{movie_data.release_date}}</td> 
                </tr>
                <tr>
                    <td> Duration (minutes): {{movie_data.duration}}</td> 
                </tr>
                <tr>
                    <td> Director: {{movie_data.director}}</td> 
                </tr>
                <tr>
                    <td> Actors: {{movie_data.actors}}</td> 
                </tr>
                <tr>
                    <td> Summary: {{movie_data.summary}}</td> 
                </tr>
                <tr>
                    <td colspan ="2"> {{movie_data.trailer}} </td>
                </table>
        </div>      
    </body>
</html>
  • 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-17T16:17:29+00:00Added an answer on June 17, 2026 at 4:17 pm

    Don’t use spaces in your urls:

    /movie_data?movie_key={{movie.key()}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a python project that we want to start testing using buildbot. Its
I'm using SQLalchemy for a Python project, and I want to have a tidy
Im using python markdown for my django project, when i have the value #/usr/bin/env
I have a problem accessing the Project Gutenberg Library... I am using Python 2.7.3.
I am using networkx (a python graph-drawing package) http://networkx.lanl.gov/index.html for one of my project.
The documentation of my project (using Python 3.2) is created with Sphinx (1.1.3) and
I am building a web application as college project (using Python), where I need
I'm working on a project, using Python running on Google App Engine. The project
I'm currently working on a project 'email to voice call'. Using python i'v extracted
I'm using a open-source Python library in my project. This library logs a lot

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.