Skip to main content

A REST API framework for building CRUD APIs using Sanic and peewee

Project description

Build Status PyPI PyPI version

sanic_crud is a REST API framework for creating a CRUD (Create/Retrieve/Update/Delete) API using Sanic and PeeWee You can use sanic_crud to automatically create an API from your PeeWee models, see how it works in the Documentation Contributions to the repository are welcome!

Example

from peewee import CharField, DateTimeField, SqliteDatabase, Model
import datetime
from sanic import Sanic
from sanic_crud import generate_crud

db = SqliteDatabase('my_app.db')

class BaseModel(Model):
    class Meta:
        database = db

class Person(BaseModel):
    name = CharField()
    email = CharField()
    create_datetime = DateTimeField(default=datetime.datetime.now, null=True)

db.create_tables([Person])

app = Sanic(__name__)
generate_crud(app, [Person])
app.run(host="0.0.0.0", port=8000, debug=True)

Installation

  • python -m pip install sanic-crud

Documentation

Documentation can be found in the docs directory.

TODO

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

sanic_crud-0.1.11.tar.gz (6.0 kB view hashes)

Uploaded Source

Supported by

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