1
我是一名使用GAE的初學者,我試圖在GAE上部署一個測試。GAE爲什麼沒有檢測到我的表單頁面?
這樣做的目的是製作一個表單,用戶輸入年份,月份和日期,然後它將生成屬於該日期的星期幾。
它工作正常,當我在localhost:8080使用「dev_appserver.py。」嘗試它時,但我將它部署到GAE後,找不到頁「/ form」。
這是鏈接到應用程序:http://yao-webapp1.appspot.com/
我猜它可能有事情做與我的app.yaml文件,但我不知道。 如果它有幫助,所有三個文件,包括bottle.py都在一個文件夾中。
編輯*當我使用GAE啓動器的GUI版本時,表單頁面也不工作。
這裏是我的代碼:
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>
OMFG !!!謝謝!!!哇我已經打破了我的頭試圖找到這方面的信息..非常感謝!!!!!!!!! – iCodeLikeImDrunk 2012-03-10 23:08:01