所以,我使用pymysql來將mysql連接到燒瓶。當我開發我的本地計算機上所有網站被罰款,後來當我上傳我的網站數字海洋嘗試連接給我一個錯誤:使用pymysql連接到mysql時出現燒瓶錯誤
'NoneType' object is not iterable
我得到的錯誤的觀點:
@app.route('/test/')
def test_page():
try:
c, conn = connection()
return("okay")
except Exception as e:
return(str(e))
連接文件看起來是這樣的:
import pymysql
def connection():
try:
conn = pymysql.connect(host="localhost", port=3306, user="root", passwd="my_password",db="db_name",charset='utf8')
c = conn.cursor()
return conn, c
except Exception as e:
print (str(e))
我堅持這個問題就像幾個小時,不能找到一個解決方案。先謝謝你。
你有整個堆棧跟蹤? –
我對整個瓶子開發事情很陌生,所以調試不是我最強大的部分,我找不到整個堆棧跟蹤。 –
做了幾個測試,發現:pymysql.err.InternalError:(1698,u「拒絕訪問用戶'root'@'localhost'」) –