weppy is a full-stack python web framework designed with simplicity in mind

Announcement: weppy reached EOL. Please check its successor Emmett
                                
                                    
from weppy import App, request
from weppy.orm import Database, Model, Field
from weppy.tools import service

class Task(Model):
    name = Field.string()
    is_completed = Field.bool(default=False)

app = App(__name__)
db = Database(app)
db.define_models(Task)
app.pipeline = [db.pipe]

@app.route(methods='get')
@service.json
def tasks():
    page = request.params.page or 1
    return {
        'tasks': Task.all().select(
            paginate=(page, 20))}                                
                            
Write elegant code

Focus on your product

You should spend more time on your product rather than the underlying framework.

weppy is the framework for humans because is designed to simplify your development process, with a syntax made to be simple, easy to learn and understand.

Don't waste your time between routers and uncomfortable patterns: every time you write down a route for your application, everything is just clearly stated in front of your eyes.

A beautiful orm

Relations in a breeze

Writing models and relations in weppy is fast and concise.

Defining the entities involved in your application shouldn't be a pain.
weppy ORM apis are designed to avoid you the hassle of writing cryptic code and to be perfectly readable even for databases amateurs.

Enjoy the elegance of your models and use your time to improve your product.

                                        
                                            
from weppy.orm import Model, Field, has_many, belongs_to

class User(Model):
    name = Field.string()
    email = Field.string()
    has_many('posts')

    validation = {
        'email': {'is': 'email'}
    }

class Post(Model):
    belongs_to('user')
    body = Field.text()

    validation = {
        'body': {'presence': True}
    }                                        
                                    
                                
                                    
class Event(Model):
    location = Field.string()
    happens_at = Field.datetime()

db.define_models(Event)

events_count = Event.id.count()

db.where(
    Event.happens_at.year() == 1955
).select(
    Event.location,
    events_count,
    groupby=Event.location,
    orderby=~events_count,
    having=(events_count > 10))                                
                            
A powerful query interface

Aggregation made easy

Just forget underscore variables and raw sql strings.

weppy comes with a powerful query interface that lets you aggregate your data using just the Python language.

Need to count events happening in the same location for a specific year? weppy lets you do that in just some few elegant lines.

A clean templating engine

Forget about templating syntax.
Use Python.

Unlike many frameworks, weppy won't propose you a new templating language, with a different syntax and logic: you shouldn't lose time for that.

The templating engine shipped with weppy is indeed just pure python code embedded in your templates, with some facilities added to the game.

Use the same language for both the back-end logic and the front-end one.

                                        
                                            
{{extend 'layout.html'}}

<div class="post-list">
{{for post in posts:}}
    <div class="post">
        <h2>{{=post.title}}</h2>
    </div>
{{pass}}
{{if not posts:}}
    <div>
        <em>No posts here so far.</em>
    </div>
{{pass}}
</div>                                        
                                    

Performance does matter

weppy is designed to be scalable and to avoid wasting response time on your applications.

Benchmarks say your application will process requests faster than other popular web frameworks.

Ready to go?

The easiest way to install weppy is from PyPI, using pip:

$ pip install weppy

Then you may want to:

Batteries included