Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are creating your Blogger entity with a parent key that you are not specifying when you are trying to retrieve your post in your <code>DisplayPost</code>.</p> <p>An entity's key is composed of multiple parts. It's Kind (<code>"Blogger"</code>), it's ID (<code>int(post_id)</code>), and also it's ancestor, or parent.</p> <p>Because you create your entity with:</p> <pre><code>a = Blogger(parent = post_key(), name = name, content = content) </code></pre> <p>You need to specify the same parent when calling <code>get_by_id()</code> (<a href="https://developers.google.com/appengine/docs/python/ndb/modelclass#Model_get_by_id" rel="nofollow">see the get_by_id() docs</a>).</p> <p>Your solution will be to change</p> <pre><code>po = Blogger.get_by_id(int(post_id)) </code></pre> <p>to</p> <pre><code>po = Blogger.get_by_id(int(post_id), parent=post_key()) </code></pre> <p>Later, if you change the name of the blog (looking at the code for post_key()), then you'll need to carry that as an argument to the post display mechanism. (You might use a subdomain as the 'name' of the blog for example).</p> <hr> <p>Here is the previous answer that addressed issues with the regex URL mapping:</p> <p>In your <code>WSGIApplication</code> definition, you have <code>('/blog/([0-9]+)', DisplayPost)], debug=True)</code>.</p> <p>You are missing the <code>r</code> before the url string to identify the string as a <strong>regular expression</strong>:</p> <p><code>(r'/blog/([0-9]+), ....</code></p> <p>You also have the option to be more verbose with <strong>parameter naming</strong>:</p> <p><code>(r'/blog/&lt;post_id:([0-9]+)&gt;, ....</code></p> <p>Reference: <a href="http://webapp-improved.appspot.com/guide/routing.html" rel="nofollow">http://webapp-improved.appspot.com/guide/routing.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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