I'm a TOTAL beginner using GAE and I am trying to deploy a test to GAE.
The objective of this is to make a form where a user enters year, month, and day, then it will generate the day of the week that belongs to that date.
It works fine when I tried it in localhost:8080 using "dev_appserver.py .", but after I deployed it to GAE, the page "/form" is not found.
This is the link to the app: http://yao-webapp1.appspot.com/
I'm guessing that it probably has something to do with my app.yaml file, but I'm not sure. If it helps with anything, all three files including bottle.py is all in one folder.
edit* also when I used the GUI version of GAE launcher, the form page does not work neither.
Here are my codes:
main.py
"""
Author: Yao Jiang
Filename: main.py
Copyright (c) 2012 All rights reserved.
"""
import bottle
from google.appengine.ext.webapp import util
from bottle import route, template, request
from datetime import date
@route('/')
def hello():
return "Hello New World!"
@route('/form')
def userDate():
if request.GET.get('userDate', '').strip():
dayOfWeek = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
year = request.GET.get('year');
month = request.GET.get('month');
day = request.GET.get('day');
userDate = date(int(year), int(month), int(day));
choice = dayOfWeek[date.weekday(userDate)];
return "<center><h1>The day of the week for %s is %s.</h1></center>" % (userDate.strftime("%b %d, %Y"), choice);
else:
return template('form.tpl');
util.run_wsgi_app(bottle.default_app())
app.yaml
application: yao-webapp1
version: 1
api_version: 1
runtime: python
handlers:
- url: .*
script: main.py
form.tpl
%# template for the date form
<html>
<body>
<p>FIND THE DAY OF THE WEEK</p>
<form action="/form" method="GET">
Year: <input type="text" size="10" maxlength="10" name="year">
Month: <input type="text" size="10" maxlength="10" name="month">
Day: <input type="text" size="10" maxlength="10" name="day">
<input type="submit" name="userDate" value="submit">
</form>
</body>
</html>
/form is a reserved url on app engine: http://code.google.com/appengine/docs/python/config/appconfig.html#Reserved_URLs
Pick a different path and it should work fine.