Bhushan Bhushan - 1 year ago 102
Python Question

Google App Engine displays nothing

I am trying to take data from user and store it in database but even my form isn't displaying on chrome. I am new to google app engine please help. Following is my complete code

import webapp2
from google.appengine.ext import db

class Dealer(db.Model):
dealer_name = db.StringProperty(required = True)
dealer_phone = db.StringProperty(required = True)

class MainHandler(webapp2.RequestHandler):
def get(self):
<form action="store_dealer" method="post">
<input type="text" name="dealer_name">
<input type="text" name="dealer_phone">
<input type="submit"/>

class StoreDealer(webapp2.RequestHandler):
def post(self):
if dealer_name && dealer_phone:
dealer = Dealer(dealer_name = dealer_name, dealer_phone = dealer_phone)

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

Answer Source

The equivalent of && is and in Python.

So your code should be like this.

class StoreDealer(webapp2.RequestHandler):
    def post(self):
        if dealer_name and dealer_phone:

To view the errors on Google App Engine, Please check its log console.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download