I have a MySql database that i created on aws rds. In my MySql workbench, the server status says "on". I also have my MySQL shell open.
I have a simple react app on the frontend, being served by flask in the backend. In main.py, i have to set these variables, but i dont know what to:
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = 'root'
app.config['MYSQL_DB'] = 'MyDB'
should the mysql host by just the endpoint provided in RDS? And the user being my Administrator IAM thing?
Im also aware that i should use this command in the sql terminal:
CREATE TABLE MyUsers ( firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL);
but im not sure where to run the above script. Do i have to open MYSQL shell in my backend folder?
For context, here is the react being served by the flask:
import React from 'react';
import './App.css';
function App() {
return (
<div className="App" style={{color:'magenta'}}>
pca app - channel 2
<p>from flask = {window.token}</p>
<form method="POST" action="">
<center>
<h1 style={{letterSpacing:'4px'}}>Enter Details : </h1> <br/>
First Name <input type = "text" name= "fname" /> <br/>
Last Name <input type = "text" name = "lname" /> <br/>
<input type = "submit"/>
</center>
</form>
</div>
);
}
and here is my main.py, where i should be setting the config variables:
app = Flask("__main__")
@app.route("/", methods=['GET', 'POST'])
def my_index():
return render_template("index.html", flask_token="Allahuabha+")
app.run(debug=True)
tldr: i would like to know what i have to set those app.config variables to.