Posts

Showing posts with the label RESTful APIs with Flask

Building RESTful APIs with Flask in PyCharm

Image
  Building RESTful APIs with Flask in PyCharm  Installing packages Once your virtualenv is ready, click the “Install” button to begin installing packages. We’ll be installing three packages for our project: Flask  (install either by pycharms STTINGS-----PYTHON INTERPRETOR (+)) Flask-Restless  (for building the RESTful API) Flask-SQLAlchemy  (for connecting to our database) || OR  MySQLdb In Pycharms (Main.py):write below code here change parameters as per your database: import flask from flask import Flask, json, request, jsonify from flask_mysqldb import MySQL, MySQLdb # pip install flask-mysqldb https://github.com/alexferl/flask-mysqldb app = Flask(__name__) app.secret_key = "2021" app.config[ 'MYSQL_HOST' ] = 'localhost' app.config[ 'MYSQL_USER' ] = 'root' app.config[ 'MYSQL_PASSWORD' ] = '' app.config[ 'MYSQL_DB' ] = 'entry_system' app.config[ 'MYSQL_CURSORCLASS' ] = 'DictCursor' mysql = MyS