Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle APP Engine datastorage design
    text
    copied!<p>I'm currently building a website on AppEngine using Python, and I've to store some informations on datastore.</p> <p>All my informations are splits in three different categories as following:</p> <p>1°/- Article (Main page news entries). 2°/- Products (Products page description entries). 3°/- Navigation (Contain all the header menu entries).</p> <p>For now, I'm storing them like this:</p> <pre><code>from google.appengine.ext import db class article(db.Model): title = db.StringProperty() body = db.TextProperty() author = db.StringProperty() aside = db.StringProperty() comment = db.StringProperty() date = db.DateProperty(auto_now_add=True) class navigation(db.Model): title = db.StringProperty() comment = db.StringProperty() link = db.StringProperty() class products(db.Model): title = db.StringProperty() body = db.TextProperty() author = db.StringProperty() aside = db.StringProperty() comment = db.StringProperty() date = db.DateProperty(auto_now_add=True) </code></pre> <p>I know this is not optimized and as you can see, my products class is the same one as the article. I think I can derive it from the article one, or extend it from, but I'm not sure.</p> <p>So my questions are:</p> <p>Do I need to use namespaces? (I want to clearly separate the articles from the products).</p> <p>What's the usual design for that kind of datastorage?</p> <p>My article body property would never have to be longer than 50 words, how could I limit the stringProperty range? Do I have to set it during my call to this property or is there any options to put on the default method of the DB class?</p> <p>Thanks a lot in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload