add form handler
This commit is contained in:
22
app/app.py
Normal file
22
app/app.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import app_config
|
||||
from flask import Flask, render_template, request
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(app_config)
|
||||
|
||||
|
||||
@app.route('/', methods=['GET', 'POST'])
|
||||
@app.route('/index.html', methods=['GET', 'POST'])
|
||||
def index():
|
||||
if request.method == "POST":
|
||||
req = request.form
|
||||
sendedEmail = req.get("email")
|
||||
sendedLink = req.get("link")
|
||||
|
||||
|
||||
return render_template('index.html')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.jinja_env.auto_reload = True
|
||||
app.run(debug=True, host='0.0.0.0')
|
||||
2
app/app_config.py
Normal file
2
app/app_config.py
Normal file
@@ -0,0 +1,2 @@
|
||||
CLIENT_SECRET = "0d169f18fb0faab17e21c7ac48415825"
|
||||
TEMPLATES_AUTO_RELOAD = "True"
|
||||
22
app/static/css/index.css
Normal file
22
app/static/css/index.css
Normal file
@@ -0,0 +1,22 @@
|
||||
html,body{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: url('../img/background.jpg');
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
height: 100vh;
|
||||
}
|
||||
.h1, h1 {
|
||||
font-size: 2.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
jumbotron{
|
||||
|
||||
}
|
||||
|
||||
form{
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
BIN
app/static/img/background.jpg
Normal file
BIN
app/static/img/background.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
4
app/templates/bootstrap4.html
Normal file
4
app/templates/bootstrap4.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
31
app/templates/index.html
Normal file
31
app/templates/index.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru ">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename = 'css/index.css')}}">
|
||||
|
||||
{% include 'bootstrap4.html'%}
|
||||
|
||||
<title>Save2pdf</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container h-100">
|
||||
<div class="row align-items-center h-100">
|
||||
<div class="col-6 mx-auto">
|
||||
<form action="" method="POST" >
|
||||
<h1> Сохрани в PDF </h1>
|
||||
<div class="form-group">
|
||||
<input type="email" class="form-control" name="email" aria-describedby="emailHelp" placeholder="Введите адрес e-mail">
|
||||
<small id="emailHelp" class="form-text text-muted">На него мы пришлем pdf</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="link" placeholder="Введите ссылку">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Сохранить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
31
app/templates/index0.html
Normal file
31
app/templates/index0.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru ">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename = 'css/index.css')}}">
|
||||
|
||||
{% include 'bootstrap4.html'%}
|
||||
|
||||
<title>Save2pdf</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container h-100">
|
||||
<div class="row align-items-center h-100">
|
||||
<div class="col-6 mx-auto">
|
||||
<form method="POST" action="" >
|
||||
<h1> Сохрани в PDF </h1>
|
||||
<div class="form-group">
|
||||
<input type="email" class="form-control" name="email" aria-describedby="emailHelp" placeholder="Введите адрес e-mail">
|
||||
<small id="emailHelp" class="form-text text-muted">На него мы пришлем pdf</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="link" placeholder="Введите ссылку">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Сохранить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user