2010-10-02 40 views
1

的app.yaml我.yaml沒有正確重定向

application: classscheduler9000 
version: 1 
runtime: python 
api_version: 1 

handlers: 
- url: /static 
    static_dir: static 

- url: /images 
    static_dir: static/images 

- url: /stylesheets 
    static_dir: static/stylesheets 

- url: /users\.html 
    script: main.py 

- url: /.* 
    script: login.py 

main.py

import hashlib 

from google.appengine.api import users 
from google.appengine.ext import webapp 
from google.appengine.ext.webapp.util import run_wsgi_app 
from google.appengine.ext import db 

class AccountHolder(db.Model): 
    ... 

class MainPage(webapp.RequestHandler): 
    def get(self): 
      ... 

class UserWrite(webapp.RequestHandler): 
    def post(self): 
     ... 

application = webapp.WSGIApplication(
            [('/', MainPage), 
             ('/sign', UserWrite)], 
            debug=True) 

def getMD5Hash(textToHash=None): 
    return hashlib.md5(textToHash).hexdigest() 

def main(): 
    run_wsgi_app(application) 

if __name__ == "__main__": 
    main() 

我目前這個離線與谷歌App Engine的測試。當我去localhost:8080時,它將我帶到我的登錄頁面。但是,當我嘗試訪問localhost:8080/users.html時,它不加載我的main.py文件(它的錯誤就像一個斷開的鏈接)。如果我交換的URL,main.py工程,但login.py不會加載。

我知道這可能是我的一些愚蠢的疏忽,我在谷歌或本網站找不到任何幫助。謝謝你的幫助。

+0

錯誤日誌中顯示什麼錯誤?發佈你的main.py應用程序定義。 – 2010-10-02 03:55:21

+0

沒有錯誤日誌。這必須是一個語義錯誤。 – btstevens89 2010-10-02 05:14:47

回答

2

問題出在您的應用程序定義上。

application = webapp.WSGIApplication([('/user\.html', MainPage), 
             ('/sign', UserWrite)], 
            debug=True) 

關於這方面的文檔在這裏,雖然它沒有「簡單」的例子。 http://code.google.com/appengine/docs/python/tools/webapp/running.html

請注意,您不需要使用.html。相反,你可以在兩個地方映射'/ user'。

+0

謝謝。我非常感謝幫助。 – btstevens89 2010-10-02 13:51:34