/lespy

A small and robust python micro framework for building simple and solid web apps.

Primary LanguagePythonMIT LicenseMIT

LESPY

GitHub stars Pytest Actions Status GitHub license PyPI PyPI download month PyPI pyversions PyPI - Wheel Open Source Helpers

Overview

A small and robust micro Python framework for building simple and solid web apps.

Quick start

DEMO: You can see a working examples here.

Instalation

Via PIP (recommended):

pip install lespy

Via Poetry:

poetry add lespy

Via GitHub:

git clone https://github.com/natanfeitosa/lespy.git && cd lespy && pip install .

Creating a simple app

In your main.py file import the App class from lespy

from lespy import App

Now instantiate the App class and pass it a name

app = App('first_app')

Now we need to create a route with the GET method

@app.get('/')
def home(request):
    return 'Hello world'

Yes, it's that simple.

Running the app

With the simple server included:

This is a simple implementation, do not use for production environment.

First import the run method

from lespy import run

Now let's use the method passing the App instance

if __name__ == '__main__':
    run(app)

Now, just run our python file, and if everything went well, just access in http://localhost:3000.

With Gunicorn:

$ gunicorn main:app