A REST API framework for building CRUD APIs using Sanic and peewee
Project description
sanic_crud
=================================
sanic_crud is a REST API framework for creating a CRUD (Create/Retrieve/Update/Delete) API using `Sanic <https://github.com/channelcat/sanic>`_ and `PeeWee <http://docs.peewee-orm.com/en/latest/>`_
You can use sanic_crud to automatically create an API from your PeeWee models, see how it works in the `Documentation <docs/using_a_sanic_crud_api.md>`_
Contributions to the repository are welcome!
Example
----------
.. code:: python
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.
Uploading to pypi (for my own sanity):
----------
* python setup.py sdist
* twine upload -r pypi dist\{latest tar}
TODO
----------
* `Get working with travis-ci <https://github.com/Typhon66/sanic_crud/issues/10>`_
* `Add sanic_openapi/swagger support <https://github.com/Typhon66/sanic_crud/issues/11>`_
* `Add support for custom routes per model <https://github.com/Typhon66/sanic_crud/issues/7>`_
* `Make int/string length validation better <https://github.com/Typhon66/sanic_crud/issues/5>`_
=================================
sanic_crud is a REST API framework for creating a CRUD (Create/Retrieve/Update/Delete) API using `Sanic <https://github.com/channelcat/sanic>`_ and `PeeWee <http://docs.peewee-orm.com/en/latest/>`_
You can use sanic_crud to automatically create an API from your PeeWee models, see how it works in the `Documentation <docs/using_a_sanic_crud_api.md>`_
Contributions to the repository are welcome!
Example
----------
.. code:: python
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.
Uploading to pypi (for my own sanity):
----------
* python setup.py sdist
* twine upload -r pypi dist\{latest tar}
TODO
----------
* `Get working with travis-ci <https://github.com/Typhon66/sanic_crud/issues/10>`_
* `Add sanic_openapi/swagger support <https://github.com/Typhon66/sanic_crud/issues/11>`_
* `Add support for custom routes per model <https://github.com/Typhon66/sanic_crud/issues/7>`_
* `Make int/string length validation better <https://github.com/Typhon66/sanic_crud/issues/5>`_
Project details
Release history Release notifications | RSS feed
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.4.tar.gz
(5.0 kB
view hashes)