Skip to main content

Create a queryable data source from an existing database.

Project description

Django Rest Framework Discovery

Build Status PyPI version

Discovery allows you to create an API from an existing database with little to no effort. This project is based on Shabda Raaj's Bookrest. You can then leverage the capabilties of the Django Rest Framework to apply filtering, pagination and documentation generation. A project demonstration is available.


For successful generation, you need to have a primary key present in the table. Otherwise, it will be silently ignored.


pip install djangorestframework-discovery

In your

    # ...

Add a variable to your named DISCOVERY_ALIAS_NAME. You can use any value, but discovery is recommended. You will use that to define the database you would like to use for viewset generation.

    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    'discovery': {
        'NAME': 'YOUR_DB_NAME',
        'ENGINE': 'django.db.backends.postgresql',
        'USER': 'YOUR_DB_USER',
        'HOST': 'YOUR_DB_HOST',
        'PORT': 'YOUR_DB_PORT',

Add the generated patterns to the rest of your application by modifying the

urlpatterns = [
    # ...
    url(r'^api/discovery/', include('rest_framework_discovery.urls')),


You can run through the testing suite by running or tox.


You can configure the following in

  • DISCOVERY_ALIAS_NAME: (required) The database alias name to use with discovery.
  • DISCOVERY_READ_ONLY: (optional) True or False, whether or not the viewsets should be read-only.
  • DISCOVERY_INCLUDE: (optional) A list of tables that you would like to only include.
  • DISCOVERY_EXCLUDE: (optional) A list of tables that you would like to ignore.

Project details

Download files

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

Files for djangorestframework-discovery, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size djangorestframework_discovery-0.1.7-py3-none-any.whl (9.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page