Aug-14-2021, 08:09 PM
I change my code a bit and that has more issues. I bet they are basic I don't see the issues. Its too new to me still.
I added a login page which must always be the first page. It will not display the page but displays index1.html.
{% extends "base.html" %} {% block title %}Login{% endblock %} {% block content
%}
<form method="POST">
<h3 align="center">Login</h3>
<div class="form-group">
<label for="email">User ID</label>
<input
type="text"
class="form-control"
id="username"
name="username"
placeholder="User Name"
/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
class="form-control"
id="password"
name="password"
placeholder="Enter password"
/>
</div>
<br />
<button type="submit" class="btn btn-primary">Login</button>
</form>
{% endblock %}
[/html]
I added a login page which must always be the first page. It will not display the page but displays index1.html.
import os from flask import Flask, render_template, request, redirect from datetime import datetime from os import environ app = Flask(__name__) @app.route('/login') @app.route('/') def login(): if request.method == ['POST', 'GET']: return render_template('login.html', username=username, password=password) else: return render_template('index1.html') @app.route('/index1') def index1(): if request.method == ['POST', 'GET']: mdate_now = str(datetime.now().date) return render_template('index1.html') else: return render_template('index1.html') if __name__ == "__main__": app.run(debug=True) driver = "IBM i Access ODBC Driver" system = 'a4gi501' username = 'myID' password = 'myPassword' connect_ibm = 'DRIVER=' + driver + ';SYSTEM=' + system + ';UID=' + username + ';PASSWORD=' + password[html]
{% extends "base.html" %} {% block title %}Login{% endblock %} {% block content
%}
<form method="POST">
<h3 align="center">Login</h3>
<div class="form-group">
<label for="email">User ID</label>
<input
type="text"
class="form-control"
id="username"
name="username"
placeholder="User Name"
/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
class="form-control"
id="password"
name="password"
placeholder="Enter password"
/>
</div>
<br />
<button type="submit" class="btn btn-primary">Login</button>
</form>
{% endblock %}
[/html]