Skip to main content

Django mock rest

Simple way to create static mock data at rest api endpoints in the Django admin.

If you’re designing a rest api client, and want to create a simple mock server for testing, then this app lets you do that using the Django admin.

Install

  • Install using

pip install django-mock-rest
  • Add django_mock_rest to installed apps in settings.py:

INSTALLED_APPS = [
        ...
        'django_mock_rest',
        ...
]
  • By default the mock service is available only in DEBUG mode. You can override this with DJANGO_MOCK_REST = True or False.

  • Add the root url to url.py:

urlpatterns = [
        ...
        url(r'^api-mock/', include('django_mock_rest.urls')),
        ...
]

How to use

In the Django admin, you can create endpoints:

https://raw.githubusercontent.com/mverleg/django_mock_rest/master/resources/admin_preview.png

After that, you can do http(s) request to the endpoints you defined:

$ curl -X GET http://127.0.0.1:8000/api-mock/post/1/
{
        "post": "Hello world"
}

You can also see an overview of all the mock endpoints (if logged in) by visiting ~, i.e. http://127.0.0.1:8000/api-mock/~.

Download files

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

Source Distribution

django-mock-rest-1.3.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file django-mock-rest-1.3.tar.gz.

File metadata

  • Download URL: django-mock-rest-1.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for django-mock-rest-1.3.tar.gz
Algorithm Hash digest
SHA256 25fae5ea4eff1eaea3e2ffd2ad281950ae52feafcd3e2307efa986cf869ac7e2
MD5 3bf056c50390f617ffc331c636d33850
BLAKE2b-256 babbe7c50d33b9671b7d8af83cdfa751e0261a2bb77bd44319da6708bff20f04

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.3 This release

1 file

1.2

1 file

1.1

1 file

1.0

1 file

Supported by

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