Skip to main content

Web APIs for Django, made easy.

Project description

### Bookrest - The easiest way to add rest API to an arbitrary DB


![bookrest image](assets/bookrest.jpg)

Bookrest allows you to add an API (and browsable htmls) to arbitrary databases -- well almost arbitrary, the tables must have PKs.
The databases do not need to be managed by Django.


#### Installation and usage


```bash
pip install bookrest
```

Then in your `settings.py`,


```python
INSTALLED_APPS = [
# ...
"rest_framework",
"bookrest",
]
```

Add a key to your `settings.DATABASES` named `bookrest`, and point it to the DB you want to expose as an API. Keep your `default` db as is, you can use it for user management and other Django apps.

```python
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
},
"bookrest": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "data/sample.sqlite3"),
},
}
```

Connect your urls to `bookrest.urls`

```python
urlpatterns = [
# ...
path("api/", include("bookrest.urls"))
]
```

🚀 Boom! You are in business. All your tables will have a full read/write API

![bookrest image](assets/bookrest.gif)

### Todo

- [X] Test with Sqlite
- [ ] Publish on Pypi
- [ ] Test with Postgres
- [ ] Test with Mysql
- [ ] Add setting to enable a read only API
- [ ] Enable circleci
- [ ] Silently drop tables with no PKs rather than failing (bad idea??)

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

bookrest-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file bookrest-0.1.1.tar.gz.

File metadata

  • Download URL: bookrest-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bookrest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b255ccba4d7faf05ee062d4edbb7cc50a75e1704ca78991f7db5ace2667e69c6
MD5 4cff3f156e0d6b8d046feccd9b343f76
BLAKE2b-256 ddb00b9a2660b328ffd213e89e54767adeb1c8accb78e82d0f3678d6c0e9f1a7

See more details on using hashes here.

Supported by

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