Aug-14-2021, 05:30 PM
(Aug-14-2021, 03:26 AM)ndc85430 Wrote: Show us the code and any errors - don't make us guess what the problem is!
import os
from flask import Flask, render_template, request, redirect
from datetime import datetime
from os import environ
app = Flask(__name__)
driver = "IBM i Access ODBC Driver"
system = 'a4gi501'
username = 'myID'
password = 'myPassword'
connect_ibm = 'DRIVER=' + driver + ';SYSTEM=' + system + ';UID=' + username + ';PASSWORD=' + password)
connection = pyodbc.connect('DRIVER=IBM i Access ODBC Driver;SYSTEM=a4gi501;UID=DFREINKEL;PWD=0urDogsandCats5;')
cursor = connection.cursor()
@app.route('/')
def index():
return render_template('/index.html')
if request.method == ['POST', 'GET']:
mdate_now = str(datetime.now().date)
return render_template('index.html')
else:
return render_template('index.html')
If I hardcode the values it works.
I also need it to run once at the beginning 0f the code.
TIA a4ginatl