Google App Engine receives and publishes on the same model

I am new to google app engine / webapp and trying to run a simple program. The application will be for a demo car rental. I would like to have a request handler for adding new cars that handle both the receipt and the message for the add car page.

The recipient must return the form to fill out and submit. The message should add a car (I'm not worried about this yet), and then return a similar page with the form and “car successfully added” or something similar.

Here is my approach:

URL mapping:

application = webapp.WSGIApplication([('/employee/add/car', AddCar)],
                                      debug=True)

AddCar:

class AddCar(webapp.RequestHandler):
    def get(self):
        self.response.out.write(template.render('templates/addcar.html', {}))

    def post(self):
        self.response.out.write(template.render('templates/addcarsuccess.html', {}))

addcar.html Template:

{% extends "base.html" %}

{% block body %}
    <h2>Add a Car</h2>

    <form action="/employee/add/car" method="post">
        <label>Make</label>
        <input type="text" name="make"></input>
        <br/>
        <input type="submit"></input>
    </form>
{% endblock body %}

I get a response 405 Method Not Allowedwhen I submit the form shown above.

, .. post , , , , .

, , , , .

, - , .

?

.

+3
1

, , post .

+3

All Articles