Beispiel #1
0
        abort(404)
    return render_template("posts.html", pagination=posts, page=page)


def make_external(url):
    return urljoin(request.url_root, url)


@app.route("/recent.atom")
def recent_feed():
    feed = AtomFeed("Recent Posts", feed_url=request.url, url=request.url_root)
    posts = Post.query.order_by(Post.pub_date.desc()).limit(15).all()
    for post in posts:
        feed.add(
            post.title,
            unicode(post.body),
            content_type="html",
            author=post.author,
            url=make_external(url_for("show_post", slug=post.slug)),
            updated=post.pub_date,
            published=post.pub_date,
        )
    return feed.get_response()


if __name__ == "__main__":
    if app.config.get("EXTERNAL", False):
        app.run(host=app.config.get("EXTERNAL_HOST", "192.168.0.1"))
    else:
        app.run()
Beispiel #2
0
from flog import app
app.run(debug=True, threaded=True)
# app.run(debug = True, processes = 4)

# Tornado
# from tornado.wsgi import WSGIContainer
# from tornado.httpserver import HTTPServer
# from tornado.ioloop import IOLoop
# from flog import app
# http_server = HTTPServer(WSGIContainer(app))
# http_server.listen(5000)
# IOLoop.instance().start()

# Gevent
# from gevent.wsgi import WSGIServer
# from flog import app
# http_server = WSGIServer(('', 5000), app)
# http_server.serve_forever()
Beispiel #3
0
if __name__ == "__main__":
    from flog import app

    app.run()