how to connect sqlalchemy to mysql and deploy it 1

how to connect sqlalchemy to mysql and deploy it

mysqlclient==1.4.2.post1
# Install this first and then use the line 
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://:@/'

Here is what the above code is Doing:
1. We are importing the Flask class from the flask module. An instance of this class will be our WSGI application.
2. We create an instance of this class. The first argument is the name of the application’s module or package. If you are using a single module (as in this example), you should use __name__ because depending on if it’s started as application or imported as module the name will be different (‘__main__’ versus the actual import name). This is needed so that Flask knows where to look for templates, static files, and so on. For more information have a look at the Flask documentation.
3. We then load the configuration from the config.py file.
4. We define the basic route / and its corresponding request handler.
5. We then start the local development server using the run() method.

Similar Posts