Guest User

Untitled

a guest
Apr 19th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. from flask import Flask, render_template, request, jsonify
  2.  
  3. app = Flask(__name__)
  4.  
  5. @app.route('/')
  6. def index():
  7. return render_template('form.html')
  8.  
  9. @app.route('/process', methods=['POST'])
  10. def process():
  11.  
  12.  
  13. name = request.form['name']
  14.  
  15. if name:
  16.  
  17. return jsonify({'name' : 'Adres pocztowy prawidłowy!'})
  18.  
  19. return jsonify({'error' : 'Kod pocztowy jest nieprawidłowy!'})
  20.  
  21. if __name__ == '__main__':
  22. app.run(debug=True)
Advertisement
Add Comment
Please, Sign In to add comment