I am running a web app on pythonanywhere and can't manage to insert new records into a table. I have the same app running locally and it works just fine. So I am wondering if I did not set up the connection properly.
I am using python3.4 and flask-mysql.
Below is my code in the app.py file:
mysql = MySQL(cursorclass=DictCursor)
app = Flask(__name__)
app.secret_key = 'why would I tell you my secret key?'
app.config['MYSQL_DATABASE_USER'] = <username>
app.config['MYSQL_DATABASE_PASSWORD'] = <password>
app.config['MYSQL_DATABASE_DB'] =<username$database_name>
app.config['MYSQL_DATABASE_HOST'] = <'username.mysql.pythonanywhere-services.com'>
mysql.init_app(app)
At the end of the file I have:
python if __name__ == "__main__":
app.run(debug = True)
Also, I am not getting any "explicit" errors but my INSERT INTO table statements are not updating my tables...(they work just fine in my localhost)
Any suggestions? Thank you