Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have been getting the following error in my python code : ImportError: cannot import name 'Flask' from partially initialized module 'flask' ( most likely

I have been getting the following error in my python code :
ImportError: cannot import name 'Flask' from partially initialized module 'flask' (most likely due to a circular import)(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/flask/__init__.py)
I need assistance in debugging the code and maybe hekp with another way of doing what I am trying to do. I tried updating flask_mysqldb but still got the same error. Please help in debugging or if possible provide a new code if possible that does the same functions. Here is the code:
from flask import Flask, render_template, request
from flask_mysqldb import MySQL
app = Flask(__name__, template_folder='Templates')
app.config["MYSQL_HOST"]= "localhost"
app.config["MYSQL_USER"]= "root"
app.config["MYSQL_PASSWORD"]= "password123"
app.config["MYSQL_DB"]= 'dash_info'
db_dash = MySQL(app)
@app.route('/', methods=["POST", "GET"])
def dash():
if request.method == "POST":
dashInfo = request.form
Insur_id = dashInfo['Insur_id']
Insur_name = dashInfo['Insur_name']
Insur_comp = dashInfo['Insur_comp']
cur = db_dash.connection.cursor()
cur.execute("INSERT INTO dash_info (Insur_id, Insur_name, Insur_comp) VALUES (%s,%s,%s)",(Insur_id, Insur_name, Insur_comp))
db_dash.connection.commit()
#fetchdata = cur.fetchall()
cur.close()
return "success"
return render_template('user_dash.html')
@app.route('/calendar') # calendar for appointments
def show_calendar():
return render_template('calendar.html')
if __name__=='__main__':
app.run(debug=True, port=8000)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How to reverse a Armstrong number by using double linked list ?

Answered: 1 week ago