Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import *
- app = Flask(__name__)
- app.jinja_env.trim_blocks = True
- app.debug = True
- @app.route('/')
- def index():
- return render_template('home.html')
- @app.route('/favicon.ico')
- def favicon():
- return app.send_static_file('favicon.ico')
- @app.route('/forum/t_<int:t_id>/')
- def f_thread(t_id):
- return '<pre>thread: %d</pre>\n' % t_id
- @app.route('/forum/t_<int:t_id>/p_<int:p_id>/')
- def f_thread_page(t_id, p_id):
- tmp = '<pre>'
- tmp += 'referrer: '+str(request.referrer)+'\n'
- tmp += 'thread: %d\npage: %d\n' % (t_id, p_id)
- tmp += '</pre>\n'
- return tmp
- @app.route('/forum/t_<int:t_id>/c_<int:c_id>/')
- def f_thread_comment(t_id, c_id):
- p_id = 2
- return redirect(url_for('f_thread_page', t_id=t_id, p_id=p_id)+'#'+str(c_id))
- if __name__ == '__main__':
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement