Hello again,
I've been totally distracted by other stuff, but I've just come back to this, because it's still confusing/worrying me a little.
Just to recap if I run my app in the console it comes up with an error saying it can't find the module (flask_mysqldb), but everything works fine. The app is using python 3.7.
A bit of my code is below (missing the login stuff, etc...):-
import os
from flask import Flask, request, send_file, jsonify, render_template, url_for, redirect
import jwt
import datetime
from functools import wraps
from flask_httpauth import HTTPBasicAuth
from werkzeug.security import generate_password_hash, check_password_hash
import paho.mqtt.publish as publish
from flask_mysqldb import MySQL
import glob
app = Flask(__name__)
app.config['SECRET_KEY'] =
app.config['MYSQL_USER'] =
app.config['MYSQL_PASSWORD'] =
app.config['MYSQL_HOST'] =
app.config['MYSQL_DB'] =
app.config['MYSQL_CURSORCLASS'] = 'DictCursor'
mysql = MySQL(app)
auth = HTTPBasicAuth()
# - create DB entry for new device ------------------------------------------
@app.route("/create_user_credentials", methods=['GET', 'POST'])
@token_required
def insert_user_credentials():
cur = mysql.connection.cursor()
unique_ID = request.args.get('unique_ID')
password = request.args.get('password')
PT_address = request.args.get('PT_address')
sql_query = '''INSERT INTO customer_info (unique_ID, password, PT_address) VALUES (%s, %s,%s)'''
cur.execute(sql_query, (unique_ID,password,PT_address,))
mysql.connection.commit()
return "200 - user created successfully"
cur.close()
mysql.connection.close()
# ----------------------------------------------------------------------------
I'm sure its obvious, but if it can't find the module, how is it working?!
Kind regards
Paul