Esempio n. 1
0
def root_static_file(name):
    def static_fn():
        fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", name)
        if os.path.exists(fn):
            return open(fn).read()
        logging.critical("root_static_file: file %s not found!" % fn)
        return abort(404, 'static file %s not found.' % fn)
    app.add_url_rule('/%s' % name, 'static_%s' % name, static_fn)
Esempio n. 2
0
def root_static_file(name):
    def static_fn():
        fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", name)
        if os.path.exists(fn):
            return open(fn).read()
        logging.critical("root_static_file: file %s not found!" % fn)
        return abort(404, 'static file %s not found.' % fn)
    app.add_url_rule('/%s' % name, 'static_%s' % name, static_fn)
Esempio n. 3
0
def root_static_file(name):
    from flask import redirect

    def static_fn():
        import os
        fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", name)
        if os.path.exists(fn):
            return open(fn).read()
        import logging
        logging.critical("root_static_file: file %s not found!" % fn)
        return redirect(404)
    app.add_url_rule('/%s' % name, 'static_%s' % name, static_fn)
Esempio n. 4
0
def root_static_file(name):
    from flask import redirect

    def static_fn():
        import os
        fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", name)
        if os.path.exists(fn):
            return open(fn).read()
        import logging
        logging.critical("root_static_file: file %s not found!" % fn)
        return redirect(404)
    app.add_url_rule('/%s' % name, 'static_%s' % name, static_fn)
Esempio n. 5
0
# -*- coding: utf-8 -*-

from base import app
import views, admin, facebook, setup


# index
app.add_url_rule('/', view_func=views.index)


# login, logout, register
app.add_url_rule('/login/', view_func=views.login, methods=['GET', 'POST'])

app.add_url_rule('/logout/', view_func=views.logout)

app.add_url_rule('/register/', view_func=views.register,
                 methods=['GET', 'POST'])


# user page, settings
app.add_url_rule('/user/<name>/', view_func=views.user_page)

app.add_url_rule('/user/settings/', view_func=views.user_settings,
                 methods=['GET', 'POST'])


# post views
app.add_url_rule('/posts/<int:post_id>/', view_func=views.get_post)

app.add_url_rule('/posts/<int:post_id>/edit/', view_func=views.edit_post,
                 methods=['GET', 'POST'])