A Flask Boilerplate to quickly get started with production-grade flask application. It has some additional packages pre-configured for ease of development.

idris-rampurawala, updated 🕥 2023-03-27 21:39:02

Flask Boilerplate

The MIT License

Flask Boilerplate to quickly get started with production grade flask application with some additional packages and configuration prebuilt.

You can find an in-depth article on this implementation here.

Contributing

We encourage you to contribute to Flask Boilerplate! Please check out the Contributing guidelines about how to proceed.

Getting Started

Prerequisites

  • Python 3.9.2 or higher
  • Up and running Redis client

Project setup

```sh

clone the repo

$ git clone https://github.com/idris-rampurawala/flask-boilerplate.git

move to the project folder

$ cd flask-boilerplate If you want to install redis via dockersh $ docker run -d --name="flask-boilerplate-redis" -p 6379:6379 redis ```

Creating virtual environment

  • Install pipenv a global python project pip install pipenv
  • Create a virtual environment for this project ```shell

creating pipenv environment for python 3

$ pipenv --three

activating the pipenv environment

$ pipenv shell

install all dependencies (include -d for installing dev dependencies)

$ pipenv install -d

if you have multiple python 3 versions installed then

$ pipenv install -d --python 3.9 ```

Configuration

  • There are 3 configurations development, staging and production in config.py. Default is development
  • Create a .env file from .env.example and set appropriate environment variables before running the project

Running app

  • Run flask app python run.py
  • Logs would be generated under log folder

Running celery workers

  • Run redis locally before running celery worker
  • Celery worker can be started with following command ```sh

run following command in a separate terminal

$ celery -A celery_worker.celery worker --loglevel='INFO'

(append --pool=solo for windows)

```

Preconfigured Packages

Includes preconfigured packages to kick start flask app by just setting appropriate configuration.

| Package | Usage | |----- |----- | | celery | Running background tasks | | redis | A Python Redis client for caching | | flask-cors | Configuring CORS | | python-dotenv | Reads the key-value pair from .env file and adds them to environment variable. | | marshmallow | A package for creating Schema, serialization, deserialization | | webargs | A Python library for parsing and validating HTTP request objects |

autopep8 & flake8 as dev packages for linting and formatting

Test

Test if this app has been installed correctly and it is working via following curl commands (or use in Postman) - Check if the app is running via status API shell $ curl --location --request GET 'http://localhost:5000/status' - Check if core app API and celery task is working via shell $ curl --location --request GET 'http://localhost:5000/api/v1/core/test' - Check if authorization is working via (change API Key as per you .env) shell $ curl --location --request GET 'http://localhost:5000/api/v1/core/restricted' --header 'x-api-key: 436236939443955C11494D448451F'

License

This program is free software under MIT license. Please see the LICENSE file in our repository for the full text.

Issues

Bump redis from 4.4.2 to 4.5.3

opened on 2023-03-27 21:39:02 by dependabot[bot]

Bumps redis from 4.4.2 to 4.5.3.

Release notes

Sourced from redis's releases.

4.5.3

Changes

Update urgency: HIGH: There is a critical bug that may affect a subset of users. Upgrade!

🐛 Bug Fixes

4.5.2

Changes

🚀 New Features

  • Introduce AbstractConnection so that UnixDomainSocketConnection can call super().init (#2588)
  • Added queue_class to REDIS_ALLOWED_KEYS (#2577)
  • Made search document subscriptable (#2615)
  • Sped up the protocol parsing (#2596)

🐛 Bug Fixes

  • Fix behaviour of async PythonParser to match RedisParser as for issue #2349 (#2582)
  • Replace async_timeout by asyncio.timeout (#2602)
  • Update json().arrindex() default values (#2611)

🧰 Maintenance

  • Coverage for pypy-3.9 (#2608)
  • Developer Experience: Adding redis version compatibility details to the README (#2621)
  • Remove redundant assignment to RedisCluster.nodes_manager. (#2620)
  • Developer Experience: [types] update return type of smismember to list[int] (#2617)
  • Developer Experience: [docs] ConnectionPool SSL example (#2605)
  • Developer Experience: Fixed CredentialsProvider examples (#2587)
  • Developer Experience: Update README to make pip install copy-pastable on zsh (#2584)
  • Developer Experience: Fix for lpop and rpop return typing (#2590)

Contributors

We'd like to thank all the contributors who worked on this release!

@​CrimsonGlory, @​Galtozzy, @​aksinha334, @​barshaul, @​chayim, @​davemcphee, @​dvora-h, @​kristjanvalur, @​ryin1, @​sileht, @​thebarbershop, @​uglide, @​woutdenolf and @​zakaf

4.5.1

Changes

🐛 Bug Fixes

  • Fix #2581 UnixDomainSocketConnection object has no attribute _command_packer (#2583)

Contributors

We'd like to thank all the contributors who worked on this release!

... (truncated)

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/idris-rampurawala/flask-boilerplate/network/alerts).

Upgrade to Python 3.11

opened on 2023-02-04 15:37:23 by idris-rampurawala

Is your feature request related to a problem? Please describe. This will update Python and its dependencies to the latest versions of Python 3.11

Idris Rampurawala

A Full Stack Developer specializes in Python (Django, Flask), Go & JavaScript technologies (Angular, Node.js)

GitHub Repository

python3 flask flask-application flask-backend flask-boilerplate python celery-workers