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/~.

Metadata

Release files for django-mock-rest 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-mock-rest 1.3
File Size Uploaded
django-mock-rest-1.3.tar.gz 5.8 kB Details

Release files / django-mock-rest-1.3.tar.gz

Download URL django-mock-rest-1.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
25fae5ea4eff1eaea3e2ffd2ad281950ae52feafcd3e2307efa986cf869ac7e2
BLAKE2b-256 checksum
How to use checksums
babbe7c50d33b9671b7d8af83cdfa751e0261a2bb77bd44319da6708bff20f04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Release history Release notifications | RSS feed

This release

1.3 This release

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page