Create a Flask microservice with a few keystrokes
Project description
create-flask-service
Set up a Flask microservice with a few keystrokes
👶 Dependencies
🛠️ Installation
Install from PyPI using pip
, you may need to use pip3
depending on your installation
$ pip install create-flask-service
🚀 Usage
- Run the
create-flask-service
command - Enter your new project name, note that spaces will be converted to dashes
- Enter the root directory for your new project, if none is supplied then the current directory is used
- Watch the magic happen
To start the application run app.py
and navigate to http://127.0.0.1:5000, you should see a blank Swagger UI page. Note that in certain IDEs like PyCharm you may need to set your working directory to the project root, this will ensure that the .env file is loaded before runtime.
📦 What's in the box
- Boilerplate directory structure. Adapted from a guide by AJ Pryor, author of the excellent flask_accepts library (included)
.
├── README.md
├── __init__.py
├── app.py
├── controller
│ └── __init__.py
├── database
│ └── __init__.py
├── interface
│ └── __init__.py
├── model
│ └── __init__.py
├── requirements.txt
├── schema
│ └── __init__.py
├── scripts
│ └── __init__.py
├── service
│ └── __init__.py
└── utils
└── __init__.py
- Python virtual environment with the following libraries installed, remember to activate the environment before developing
- flask - The Python micro framework for building web applications
- flask-restx - Fully featured framework for fast, easy and documented API development with Flask
- flask_accepts - Easy, opinionated Flask input/output handling mixing Marshmallow with flask-restx
- flask-compress - Compress responses in your Flask app with gzip
- flask-cors - Cross Origin Resource Sharing ( CORS ) support for Flask
- python-dotenv - Get and set values in your .env file in local and production servers
- marshmallow - A lightweight library for converting complex objects to and from simple Python datatypes
- python-jose - A JOSE implementation in Python
- werkzeug - The comprehensive WSGI web application library
- flask-sqlalchemy - The Database Toolkit for Python
- pyodbc - Python ODBC bridge
- typing-extensions
- Note that this is only needed for Python <3.7
- Basic Flask and Flask-RestX configuration
- app.py contains basic configuration setting up Flask, Flask-SQLAlchemy, CORS, and gzip compression
- controller/__init__.py contains basic Flask-RestX configuration based on the Flask-RestX guidelines
- Boilerplate code style is formatted with Black, but you may use whatever style suits you
- Initialized git repository with a Python-specific .gitignore file
- Nothing will be committed automatically
- Basic README.md file
⚖️ License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for create-flask-service-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8ad73e74d8f2da14ae9e4e2ef83c369e1b292aa7b1c2d7374fe5491d0375cbf |
|
MD5 | 1086a780de7fb92c7cbe2bd3870fbe37 |
|
BLAKE2b-256 | b8f4be026373c1ab327adc2a43dc5486c5e2276e1399755b744178083783f8e2 |
Close
Hashes for create_flask_service-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 428c9f38779389214c7ee596c550bb4b219690f36b9842d8a37fbef797fbb0a7 |
|
MD5 | 0cd84e8ab21caf90f48bba20382dc590 |
|
BLAKE2b-256 | 2b9b3258fdede308443159d591d844bd7bd725dbcffe0ff8bf6751ef9b46c5f2 |