Skip to main content

Fast and simple micro web framework

Project description

Installation

$ pip install pysi

Hello world

import pysi

@pysi.view('/')
def home(rq):
    return 'Hello world!'

if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    make_server('', 8000, pysi.App()).serve_forever()

Another example

from pysi import cfg, view, redirect, abort
from models import Profile
from forms import ProfileForm

@view('/profile/<int:id>/edit/', 'profile/edit.html')
def edit(rq, id):
    obj = Profile.get(id)
    if not obj or obj.user != rq.user:
        abort(404)
    form = ProfileForm(rq.form)
    if rq.method == 'POST' and form.validate():
        form.populate_obj(obj)
        obj.save()
        rq.flash('Profile updated', 'success')
        return redirect('profile.edit')
    return {'form': form, 'post': post}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysi-0.19.0.tar.gz (14.7 kB view details)

Uploaded Source

File details

Details for the file pysi-0.19.0.tar.gz.

File metadata

  • Download URL: pysi-0.19.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pysi-0.19.0.tar.gz
Algorithm Hash digest
SHA256 642e55dbb394c66cba11fd00550df6b22a74e12414988bdbf11a09767e675001
MD5 174cbb756bc86909af50828e65bb493d
BLAKE2b-256 1ebcc1b77651e70bd79cb784111cd4b1f2b612930b7fa141e9ed517939312cef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page