Skip to content

created post @id's refer to API_URI, but feed view searches for posts on SERVER_URI #89

@npdoty

Description

@npdoty

Created posts have an @id like: "@id" : "http://api.smilodon.localhost:5000/test/posts/0", but the viewPost route queries for a post with @id at the request's url_root, which isn't typically the same. So, when I try to load a particular post in the web browser, the server throws an error like:

16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/views.py", line 118, in viewPost
16:50:01 web.1   |      return render_template('feed.html', posts=p, mongo=mongo)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/flask/templating.py", line 134, in render_template
16:50:01 web.1   |      context, ctx.app)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/flask/templating.py", line 116, in _render
16:50:01 web.1   |      rv = template.render(context)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render
16:50:01 web.1   |      return self.environment.handle_exception(exc_info, True)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception
16:50:01 web.1   |      reraise(exc_type, exc_value, tb)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
16:50:01 web.1   |      raise value.with_traceback(tb)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/templates/feed.html", line 1, in top-level template code
16:50:01 web.1   |      {% extends 'basic.html' %}
16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/templates/basic.html", line 37, in top-level template code
16:50:01 web.1   |      <div class="content">{% block content %}{% endblock content %}</div>
16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/templates/feed.html", line 4, in block "content"
16:50:01 web.1   |      <p> {%for p in posts%}
16:50:01 web.1   |  TypeError: 'NoneType' object is not iterable

Whether there need to be separate URIs for the API and the server at all is also unclear to me, but probably a separate issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions