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.2.4.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file sanic_crud-0.2.4.tar.gz.

File metadata

  • Download URL: sanic_crud-0.2.4.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sanic_crud-0.2.4.tar.gz
Algorithm Hash digest
SHA256 aaa0f58b72a08fe9fec3202f4673888d314729d4e1e35089ee24e7bf58ea251b
MD5 dbd3a1a7265b8797c1face89e3fe0723
BLAKE2b-256 621a94667602e05cc679895a032ed1b90887cdb6012e5afe1a8d92f8869ba697

See more details on using hashes here.

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