Текст ошибки: "Bad Request
The browser (or proxy) sent a request that this server could not understand."
#Import dependencies
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
#Create instance of Flask App
app = Flask(__name__)
#Connect to the Database
app.config['SQLALCHEMY_DATABASE_URI']='postgresql://****:****@localhost/****
db = SQLAlchemy(app)
class Data(db.Model):
#create a table
__tablename__ = "discart"
id = db.Column(db.Integer, primary_key = True)
countid = db.Column(db.Integer)
def __init__(self, countid):
self.countid = countid
#Define Route and Contant of that page
@app.route("/")
def index():
return render_template("index.html")
#Define 2nd Route and Content
@app.route("/success", methods = ['POST'])
def success():
if(request.method == 'POST'):
countid_ = request.form["count"]
discart = Data(countid_)
db.session.add(discart)
db.session.commit()
return render_template("success.html")
#Running and Controlling the script
if (__name__ =="__main__"):
app.run(debug=True)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Card Activation</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="images/icons/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="../static/css/main.css">
</head>
<body>
<div class="container-contact100">
<div class="wrap-contact100">
<form class="contact100-form validate-form" action="{{url_for('success')}}" method="POST">
<span class="contact100-form-title">
Card Activation
</span>
<div class="wrap-input100 validate-input" data-validate="Name is required">
<input class="input100" type="text" name="count_id" maxlength="16" placeholder="Enter your card number">
<span class="focus-input100"></span>
</div>
<div class="container-contact100-form-btn">
<div class="wrap-contact100-form-btn">
<div class="contact100-form-bgbtn"></div>
<button class="contact100-form-btn" type="confirm">
<span>
Confirm
</span>
</button>
</div>
</div>
</form>
</div>
</div>
</body>
</html>