python-sample-flask-application icon indicating copy to clipboard operation
python-sample-flask-application copied to clipboard

Sample Flask application using Flask-RESTPlus , Flask-Marshmallow and Flask-SQLAlchemy

Sample Flask application using Flask-RESTPlus , Flask-Marshmallow and Flask-SQLAlchemy

Setting up the VirtualEnv and install dependencies

Go inside the project folder and execute the below commands. We will use Pipenv to setup the VirtualEnv.

pipenv shell
pipenv install

Dependencies will be installed from the Pipfile. Python version 3.7 is used for this project.

Run the Application

python app.py

This will start the application on port 5000

Test the application

Swagger-UI can be used to test the application. alt text

The server will start at http://localhost:5000.

DockerFile

It also contain the DockerFile . In case we need to deploy it with Docker.


docker build -t sumand/python-sample-flask .

docker run -d -p 5000:5000 sumand/python-sample-flask:latest

Please check my write-up for further details https://dassum.medium.com/building-rest-apis-using-flask-restplus-sqlalchemy-marshmallow-cff76b202bfb