Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Welcome.html:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset='utf-8'>
- <meta http-equiv='X-UA-Compatible' content='IE=edge'>
- <title>Login</title>
- <meta name='viewport' content='width=device-width, initial-scale=1'>
- <link rel='stylesheet' type='text/css' media='screen' href='/static/style.css'>
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
- <script src="/static/index.js"></script>
- </head>
- <body>
- <div id="top">
- <h1>Welcome!</h1>
- <!-- {%for key, value in links.items()%}
- <a href="{{value}}">{{key}}</a>
- {%endfor%} -->
- </div>
- <div style="text-align: center;">
- {% if message %}
- <p class="valid"> {{message}} </p>
- {% endif %}
- <!-- Youre logged in as {{username}} -->
- <!-- To Log out click <a href="/logout">this</a> link -->
- </div>
- </body>
- </html>
- style.css:
- #top {
- background-color: blanchedalmond;
- border: 2px solid black;
- box-shadow: 0px 5px 5px black inset;
- text-align: center;
- margin: 10px;
- }
- body {
- text-align: center;
- background-color: navajowhite !important;
- }
- * {
- font-family:
- 'Arial';
- }
- .wrapper {
- width: 20%;
- padding: 10px;
- border-radius: 5px;
- background: #f8ca85;
- margin: auto;
- }
- form {
- margin: 25px auto;
- }
- .btn {
- width: auto;
- border: none;
- margin-top: 5px;
- color: white;
- background-color: #3b5998;
- border-radius: 5px;
- padding: 12px;
- }
- .form-control {
- width: 50%;
- }
- .error {
- color: red;
- text-align: center;
- }
- .valid {
- color: green;
- }
- app.py
- from flask import Flask, render_template, request, session, make_response, redirect
- app = Flask(__name__)
- app.secret_key = "super secret key"
- if __name__ == '__main__':
- import os
- HOST = os.environ.get('SERVER_HOST', 'localhost')
- try:
- PORT = int(os.environ.get('SERVER_PORT', '5555'))
- except ValueError:
- PORT = 5555
- app.run(HOST, PORT)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement