frog.py 593 B

123456789101112131415161718192021222324
  1. from flask import Flask,request,make_response,redirect,render_template,url_for,abort,flash
  2. app=Flask(__name__)
  3. app.config['SECRET_KEY']='132456'
  4. @app.errorhandler(404)
  5. def page_not_found(e):
  6. return render_template('404.html'),404
  7. @app.errorhandler(500)
  8. def internal_server_error(e):
  9. return render_template('500.html'),500
  10. @app.route('/')
  11. def index():
  12. return render_template('index.html')
  13. @app.route('/post/')
  14. def posts():
  15. page=request.args.get('page')
  16. return '<h1>%s</h1>' % page
  17. @app.route('/post/<int:id>')
  18. def post(id):
  19. return render_template('post.html',id=id)