Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- path = 'foo'
- @app.route('/<path:path>', methods=['POST'])
- def index(path=None):
- # do some stuff...
- return flask.render_template('index.html', path=path)
- from flask import Flask, render_template
- app = Flask(__name__)
- @app.route('/')
- def index():
- return render_template('index.html')
- @app.route('/<word>', defaults={'word': 'bird'})
- def word_up(word):
- return render_template('whatstheword.html', word=word)
- @app.route('/files/<path:path>')
- def serve_file(path):
- return send_from_directory(app.config['UPLOAD_DIR'], path, as_attachment=True)
- if __name__ == '__main__':
- app.debug = True
- app.run(port=9017)
- def index(path=None):
- return render_template('index.html', path=path)
- path = '/foo'
- app.add_url_rule(path, 'index', index)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement