1

我有我認爲我需要在谷歌應用程序引擎中的模型。我基本上建立了分類廣告系統。我有數據模型...現在在Google App Engine中使用Python

這是我到目前爲止有:

class Cities(db.Model): 
    name = db.StringProperty() 
    connectors = db.ListProperty() 
    catList = db.ListProperty() 



class Listings(db.model): 
    title = db.StringProperty() 
    category = db.CategoryProperty() 
    city = db.StringProperty() 
    editURL = db.LinkProperty() 
    email = db.EmailProperty() 
    phone = db.PhoneNumber() 
    user = db.UserProperty() 
    date = db.DateTimeProperty(auto_now_add=True) 
    content = db.TextProperty() 
    picture = db.BlobProperty() 
    location = db.StringProperty() 

有什麼明顯的錯誤與那些?另外,我將這些文件放在一個名爲dbmodels.py的文件中,與Google App引擎的所有其他文件位於同一個目錄中。有沒有辦法將這些文件導入到需要使用的特定文件中?

最後,我有一個我想要表示的城市的列表。我怎樣才能把它變成谷歌應用程序引擎?建立一個可以創建我自己的城市的儀表板是正確的嗎?

謝謝大家提前!

回答

2
  1. 沒有什麼明顯的錯誤與他們
  2. 在類似i_use_models.py已經from dbmodels import Cities, Listings(假設他們是在同一個文件夾中),並使用CitiesListings
  3. 這是正確的方式,但只作肯定管理員可以編輯它。 (或者,更好地閱讀下面的Thomas K的評論)
+1

3,你可以從應用程序的儀表板做簡單的數據存儲管理,這在這種情況下可能是有用的。還有一種方法可以從API中運行批量上傳數據,但如果您稍後想要編輯某些內容,則無用。 – 2010-12-07 18:17:23

相關問題