zerowords
zerowords

Reputation: 3113

How do you run example code snippets with html output from gae?

The following code comes from here. How am I supposed to see the results? Can I use the GAE interactive console somehow, or do I need to create a whole app with an app.yaml etc and run it in the gae launcher? I am particularly interested in snippets with html.

import datetime

from google.appengine.ext import webapp

class MyRequestHandler(webapp.RequestHandler):
    def get(self):
        self.response.out.write("<html><body>")
        self.response.out.write("<p>Welcome to the Internet!</p>")
        self.response.out.write("</body></html>")

        expires_date = datetime.datetime.utcnow() + datetime.timedelta(365)
        expires_str = expires_date.strftime("%d %b %Y %H:%M:%S GMT")
        self.response.headers.add_header("Expires", expires_str)

Upvotes: 0

Views: 114

Answers (2)

Hans Then
Hans Then

Reputation: 11322

Have you installed the development appserver?

Upvotes: 0

Daniel Roseman
Daniel Roseman

Reputation: 599510

You're supposed to run it in the development server. You see the results in your browser.

Upvotes: 1

Related Questions