Best Flask open-source libraries and packages

Veresk

Generate and share your favorite fractals. This runs serverless via AWS Lambda.
Updated 1 year ago

Veresk

Introduction

This app gives you ability to create different images of fractals.

What is a fractal? It is a picture produced my mathematical expression which have recursive nature with unlimited zooming capabilities.

As image generation controlled by expression, changing the expression even in the slighest manner will result in a sometimes complete different image.

See Wikipedia page for more introduction.

Example

This example is a Julia set generated with base complex number c = -0.37 + 0.6*i

Julia set is a subset of well-known Mandelbrot set.

Requirements

This app requires MongoDB instance available (running in the docker or in the cloud) by setting MONGO_URI environment variable:

MONGO_URI=mongodb://localhost/test

Running locally

You need to have Python 3.7 installed.

pip install pipenv
pipenv install
MONGO_URI=mongodb://localhost/test FLASK_SECRET_KEY=123 GITHUB_OAUTH_CLIENT_ID= GITHUB_OAUTH_CLIENT_SECRET= CACHE_BUCKET= pipenv run python -m app

Your app will be available at http://localhost:8080

Deploying

This project uses chamber CLI, AWS, MongoDB Atlas and Serverless framework to deploy to the cloud. This result in a highly available, cost-effective, secure and environment to host and serve hobby projects.

Configure MongoDB instance

Create MongoDB instance using cloud service (for example MongoDB atlas).

You will get URL in the form of:

mongodb+srv://username:password@server.mongodb.net/db

Create AWS account in the cloud

The way this app uses AWS services, hosting this app will cost you 0.1$ monthly or less, depending on the traffic. Make sure you are protecting your AWS account as the malicious actions of other parties or mistakes can result in a large bill. Read more here about getting started in AWS.

Configuring other resources in the cloud

To run successfully full fledged version of the app, number of parameters needs to be set using AWS Parameter Store as /veresk/NAME_OF_VARIABLE key. Encrypt using default key (do not use custom KMS key).

  • MONGO_URI - URL to previously configured MongoDB instance
  • FLASK_SECRET_KEY - Private key for your Flask app
  • GITHUB_OAUTH_CLIENT_ID - Credentials for GitHub login (create app in Developer settings)
  • GITHUB_OAUTH_CLIENT_SECRET - Credentials for GitHub login
  • CACHE_BUCKET - Create and give access to S3 bucket to store image cache

Deploy instance to the cloud

You need to have NodeJS 11+, python 3.7+, pipenv and NPM installed.

npm install
pip install pipenv
pipenv install
pipenv run deploy

Licenses

Links