django-rest-framework/topics/third-party-resources/index.html

679 lines
40 KiB
HTML
Raw Normal View History

2014-11-25 19:04:38 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
2015-05-15 11:19:49 +03:00
<title>Third Party Resources - Django REST framework</title>
2014-11-25 19:04:38 +03:00
<link href="../../img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://www.django-rest-framework.org/topics/third-party-resources/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Django, API, REST, Third Party Resources">
<meta name="author" content="Tom Christie">
<!-- Le styles -->
<link href="../../css/prettify.css" rel="stylesheet">
<link href="../../css/bootstrap.css" rel="stylesheet">
<link href="../../css/bootstrap-responsive.css" rel="stylesheet">
<link href="../../css/default.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18852272-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<style>
2016-05-26 13:48:39 +03:00
#sidebarInclude img {
margin-bottom: 10px;
}
#sidebarInclude a.promo {
2014-11-25 19:04:38 +03:00
color: black;
2016-05-26 13:48:39 +03:00
}
2014-11-25 19:04:38 +03:00
@media (max-width: 767px) {
div.promo {
display: none;
}
}
</style>
</head>
<body onload="prettyPrint()" class="-page">
<div class="wrapper">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
2015-06-04 17:37:22 +03:00
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../contributing/">
2014-11-25 19:04:38 +03:00
Next <i class="icon-arrow-right icon-white"></i>
</a>
2015-06-04 17:37:22 +03:00
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../rest-hypermedia-hateoas/">
2014-11-25 19:04:38 +03:00
<i class="icon-arrow-left icon-white"></i> Previous
</a>
2015-06-04 17:37:22 +03:00
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
2014-11-25 19:04:38 +03:00
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
<div class="nav-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
2015-06-04 17:37:22 +03:00
<li >
<a href="../..">Home</a>
</li>
2014-11-25 19:04:38 +03:00
<li class="dropdown">
2014-11-25 19:31:00 +03:00
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
2014-11-25 19:04:38 +03:00
<ul class="dropdown-menu">
<li >
2015-06-04 17:37:22 +03:00
<a href="../../tutorial/quickstart/">Quickstart</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
<a href="../../tutorial/7-schemas-and-client-libraries/">7 - Schemas and client libraries</a>
</li>
2014-11-25 19:04:38 +03:00
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API Guide <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/requests/">Requests</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/responses/">Responses</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/views/">Views</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/generic-views/">Generic views</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/viewsets/">Viewsets</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/routers/">Routers</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/parsers/">Parsers</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/renderers/">Renderers</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/serializers/">Serializers</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/fields/">Serializer fields</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/relations/">Serializer relations</a>
2014-11-25 19:04:38 +03:00
</li>
2014-12-01 15:20:07 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/validators/">Validators</a>
2014-12-01 15:20:07 +03:00
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/authentication/">Authentication</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/permissions/">Permissions</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/throttling/">Throttling</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/filtering/">Filtering</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/pagination/">Pagination</a>
2014-11-25 19:04:38 +03:00
</li>
2015-03-06 15:05:16 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/versioning/">Versioning</a>
2015-03-06 15:05:16 +03:00
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/content-negotiation/">Content negotiation</a>
2014-11-25 19:04:38 +03:00
</li>
2014-12-18 18:42:42 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/metadata/">Metadata</a>
2014-12-18 18:42:42 +03:00
</li>
2014-11-25 19:04:38 +03:00
<li >
<a href="../../api-guide/schemas/">Schemas</a>
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/format-suffixes/">Format suffixes</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/reverse/">Returning URLs</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/exceptions/">Exceptions</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/status-codes/">Status codes</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/testing/">Testing</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../../api-guide/settings/">Settings</a>
2014-11-25 19:04:38 +03:00
</li>
</ul>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
2015-06-04 17:37:22 +03:00
<a href="../documenting-your-api/">Documenting your API</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
<a href="../api-clients/">API Clients</a>
</li>
2015-03-06 15:05:16 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../internationalization/">Internationalization</a>
2015-03-06 15:05:16 +03:00
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../ajax-csrf-cors/">AJAX, CSRF & CORS</a>
2014-11-25 19:04:38 +03:00
</li>
2015-10-28 14:35:39 +03:00
<li >
<a href="../html-and-forms/">HTML & Forms</a>
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../browser-enhancements/">Browser Enhancements</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../browsable-api/">The Browsable API</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
2014-11-25 19:04:38 +03:00
</li>
<li class="active" >
2015-06-04 17:37:22 +03:00
<a href="./">Third Party Resources</a>
2014-11-25 19:04:38 +03:00
</li>
<li >
2015-06-04 17:37:22 +03:00
<a href="../contributing/">Contributing to REST framework</a>
2014-11-25 19:04:38 +03:00
</li>
2014-12-18 16:49:50 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../project-management/">Project management</a>
2014-12-18 16:49:50 +03:00
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../3.0-announcement/">3.0 Announcement</a>
2014-11-25 19:04:38 +03:00
</li>
2014-12-01 15:20:07 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../3.1-announcement/">3.1 Announcement</a>
2014-12-01 15:20:07 +03:00
</li>
2015-08-06 16:31:52 +03:00
<li >
<a href="../3.2-announcement/">3.2 Announcement</a>
</li>
2015-10-28 14:35:39 +03:00
<li >
<a href="../3.3-announcement/">3.3 Announcement</a>
</li>
<li >
<a href="../3.4-announcement/">3.4 Announcement</a>
</li>
<li >
<a href="../3.5-announcement/">3.5 Announcement</a>
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../kickstarter-announcement/">Kickstarter Announcement</a>
2014-11-25 19:04:38 +03:00
</li>
2016-05-26 13:48:39 +03:00
<li >
<a href="../mozilla-grant/">Mozilla Grant</a>
</li>
<li >
<a href="../funding/">Funding</a>
</li>
2014-11-25 19:04:38 +03:00
<li >
2015-06-04 17:37:22 +03:00
<a href="../release-notes/">Release Notes</a>
2014-11-25 19:04:38 +03:00
</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<div class="body-content">
<div class="container-fluid">
<!-- Search Modal -->
2015-06-04 17:37:22 +03:00
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
2014-11-25 19:04:38 +03:00
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="myModalLabel">Documentation search</h3>
</div>
<div class="modal-body">
2015-08-06 16:31:52 +03:00
<form role="form" autocomplete="off">
2015-06-04 17:37:22 +03:00
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
</div>
</form>
<div id="mkdocs-search-results"></div>
2014-11-25 19:04:38 +03:00
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<div id="table-of-contents">
<ul class="nav nav-list side-nav well sidebar-nav-fixed">
<li class="main">
<a href="#third-party-resources">Third Party Resources</a>
</li>
<li>
<a href="#about-third-party-packages">About Third Party Packages</a>
</li>
<li>
<a href="#how-to-create-a-third-party-package">How to create a Third Party Package</a>
</li>
<li>
<a href="#existing-third-party-packages">Existing Third Party Packages</a>
</li>
<li>
<a href="#other-resources">Other Resources</a>
</li>
2016-05-26 13:48:39 +03:00
<div class="promo">
<hr/>
<div id="sidebarInclude">
</div>
2014-11-25 19:04:38 +03:00
</ul>
</div>
</div>
<div id="main-content" class="span9">
2015-06-04 17:37:22 +03:00
2015-11-04 17:59:23 +03:00
<h1 id="third-party-resources"><a class="toclink" href="#third-party-resources">Third Party Resources</a></h1>
2014-12-11 12:55:10 +03:00
<blockquote>
<p>Software ecosystems […] establish a community that further accelerates the sharing of knowledge, content, issues, expertise and skills.</p>
<p>&mdash; <a href="http://www.software-ecosystems.com/Software_Ecosystems/Ecosystems.html">Jan Bosch</a>.</p>
</blockquote>
2015-11-04 17:59:23 +03:00
<h2 id="about-third-party-packages"><a class="toclink" href="#about-third-party-packages">About Third Party Packages</a></h2>
2014-11-25 19:04:38 +03:00
<p>Third Party Packages allow developers to share code that extends the functionality of Django REST framework, in order to support additional use-cases.</p>
2014-12-01 15:20:07 +03:00
<p>We <strong>support</strong>, <strong>encourage</strong> and <strong>strongly favor</strong> the creation of Third Party Packages to encapsulate new behavior rather than adding additional functionality directly to Django REST Framework.</p>
<p>We aim to make creating third party packages as easy as possible, whilst keeping a <strong>simple</strong> and <strong>well maintained</strong> core API. By promoting third party packages we ensure that the responsibility for a package remains with its author. If a package proves suitably popular it can always be considered for inclusion into the core REST framework.</p>
<p>If you have an idea for a new feature please consider how it may be packaged as a Third Party Package. We're always happy to discuss ideas on the <a href="https://groups.google.com/forum/#!forum/django-rest-framework">Mailing List</a>.</p>
2015-11-04 17:59:23 +03:00
<h2 id="how-to-create-a-third-party-package"><a class="toclink" href="#how-to-create-a-third-party-package">How to create a Third Party Package</a></h2>
<h3 id="creating-your-package"><a class="toclink" href="#creating-your-package">Creating your package</a></h3>
2014-11-25 19:04:38 +03:00
<p>You can use <a href="https://github.com/jpadilla/cookiecutter-django-rest-framework">this cookiecutter template</a> for creating reusable Django REST Framework packages quickly. Cookiecutter creates projects from project templates. While optional, this cookiecutter template includes best practices from Django REST framework and other packages, as well as a Travis CI configuration, Tox configuration, and a sane setup.py for easy PyPI registration/distribution.</p>
<p>Note: Let us know if you have an alternate cookiecuter package so we can also link to it.</p>
2015-11-04 17:59:23 +03:00
<h4 id="running-the-initial-cookiecutter-command"><a class="toclink" href="#running-the-initial-cookiecutter-command">Running the initial cookiecutter command</a></h4>
2014-11-25 19:04:38 +03:00
<p>To run the initial cookiecutter command, you'll first need to install the Python <code>cookiecutter</code> package.</p>
<pre><code>$ pip install cookiecutter
</code></pre>
<p>Once <code>cookiecutter</code> is installed just run the following to create a new project.</p>
<pre><code>$ cookiecutter gh:jpadilla/cookiecutter-django-rest-framework
</code></pre>
<p>You'll be prompted for some questions, answer them, then it'll create your Python package in the current working directory based on those values.</p>
<pre><code>full_name (default is "Your full name here")? Johnny Appleseed
email (default is "you@example.com")? jappleseed@example.com
github_username (default is "yourname")? jappleseed
pypi_project_name (default is "dj-package")? djangorestframework-custom-auth
repo_name (default is "dj-package")? django-rest-framework-custom-auth
app_name (default is "djpackage")? custom_auth
project_short_description (default is "Your project description goes here")?
year (default is "2014")?
version (default is "0.1.0")?
</code></pre>
2015-11-04 17:59:23 +03:00
<h4 id="getting-it-onto-github"><a class="toclink" href="#getting-it-onto-github">Getting it onto GitHub</a></h4>
2014-11-25 19:04:38 +03:00
<p>To put your project up on GitHub, you'll need a repository for it to live in. You can create a new repository <a href="https://github.com/new">here</a>. If you need help, check out the <a href="https://help.github.com/articles/create-a-repo/">Create A Repo</a> article on GitHub.</p>
2015-11-04 17:59:23 +03:00
<h4 id="adding-to-travis-ci"><a class="toclink" href="#adding-to-travis-ci">Adding to Travis CI</a></h4>
2014-11-25 19:04:38 +03:00
<p>We recommend using <a href="https://travis-ci.org">Travis CI</a>, a hosted continuous integration service which integrates well with GitHub and is free for public repositories.</p>
<p>To get started with Travis CI, <a href="https://travis-ci.org">sign in</a> with your GitHub account. Once you're signed in, go to your <a href="https://travis-ci.org/profile">profile page</a> and enable the service hook for the repository you want.</p>
<p>If you use the cookiecutter template, your project will already contain a <code>.travis.yml</code> file which Travis CI will use to build your project and run tests. By default, builds are triggered everytime you push to your repository or create Pull Request.</p>
2015-11-04 17:59:23 +03:00
<h4 id="uploading-to-pypi"><a class="toclink" href="#uploading-to-pypi">Uploading to PyPI</a></h4>
2014-11-25 19:04:38 +03:00
<p>Once you've got at least a prototype working and tests running, you should publish it on PyPI to allow others to install it via <code>pip</code>.</p>
<p>You must <a href="https://pypi.python.org/pypi?%3Aaction=register_form">register</a> an account before publishing to PyPI.</p>
<p>To register your package on PyPI run the following command.</p>
<pre><code>$ python setup.py register
</code></pre>
<p>If this is the first time publishing to PyPI, you'll be prompted to login.</p>
<p>Note: Before publishing you'll need to make sure you have the latest pip that supports <code>wheel</code> as well as install the <code>wheel</code> package.</p>
<pre><code>$ pip install --upgrade pip
$ pip install wheel
</code></pre>
<p>After this, every time you want to release a new version on PyPI just run the following command.</p>
<pre><code>$ python setup.py publish
You probably want to also tag the version now:
git tag -a {0} -m 'version 0.1.0'
git push --tags
</code></pre>
<p>After releasing a new version to PyPI, it's always a good idea to tag the version and make available as a GitHub Release.</p>
<p>We recommend to follow <a href="http://semver.org/">Semantic Versioning</a> for your package's versions.</p>
2015-11-04 17:59:23 +03:00
<h3 id="development"><a class="toclink" href="#development">Development</a></h3>
<h4 id="version-requirements"><a class="toclink" href="#version-requirements">Version requirements</a></h4>
2014-11-25 19:04:38 +03:00
<p>The cookiecutter template assumes a set of supported versions will be provided for Python and Django. Make sure you correctly update your requirements, docs, <code>tox.ini</code>, <code>.travis.yml</code>, and <code>setup.py</code> to match the set of versions you wish to support.</p>
2015-11-04 17:59:23 +03:00
<h4 id="tests"><a class="toclink" href="#tests">Tests</a></h4>
2014-11-25 19:04:38 +03:00
<p>The cookiecutter template includes a <code>runtests.py</code> which uses the <code>pytest</code> package as a test runner.</p>
<p>Before running, you'll need to install a couple test requirements.</p>
2014-12-05 12:44:35 +03:00
<pre><code>$ pip install -r requirements.txt
2014-11-25 19:04:38 +03:00
</code></pre>
<p>Once requirements installed, you can run <code>runtests.py</code>.</p>
<pre><code>$ ./runtests.py
</code></pre>
<p>Run using a more concise output style.</p>
<pre><code>$ ./runtests.py -q
</code></pre>
<p>Run the tests using a more concise output style, no coverage, no flake8.</p>
<pre><code>$ ./runtests.py --fast
</code></pre>
<p>Don't run the flake8 code linting.</p>
<pre><code>$ ./runtests.py --nolint
</code></pre>
<p>Only run the flake8 code linting, don't run the tests.</p>
<pre><code>$ ./runtests.py --lintonly
</code></pre>
<p>Run the tests for a given test case.</p>
<pre><code>$ ./runtests.py MyTestCase
</code></pre>
<p>Run the tests for a given test method.</p>
<pre><code>$ ./runtests.py MyTestCase.test_this_method
</code></pre>
<p>Shorter form to run the tests for a given test method.</p>
<pre><code>$ ./runtests.py test_this_method
</code></pre>
<p>To run your tests against multiple versions of Python as different versions of requirements such as Django we recommend using <code>tox</code>. <a href="https://tox.readthedocs.io/en/latest/">Tox</a> is a generic virtualenv management and test command line tool.</p>
2014-11-25 19:04:38 +03:00
<p>First, install <code>tox</code> globally.</p>
<pre><code>$ pip install tox
</code></pre>
<p>To run <code>tox</code>, just simply run:</p>
<pre><code>$ tox
</code></pre>
<p>To run a particular <code>tox</code> environment:</p>
<pre><code>$ tox -e envlist
</code></pre>
<p><code>envlist</code> is a comma-separated value to that specifies the environments to run tests against. To view a list of all possible test environments, run:</p>
<pre><code>$ tox -l
</code></pre>
2015-11-04 17:59:23 +03:00
<h4 id="version-compatibility"><a class="toclink" href="#version-compatibility">Version compatibility</a></h4>
2014-11-25 19:04:38 +03:00
<p>Sometimes, in order to ensure your code works on various different versions of Django, Python or third party libraries, you'll need to run slightly different code depending on the environment. Any code that branches in this way should be isolated into a <code>compat.py</code> module, and should provide a single common interface that the rest of the codebase can use.</p>
<p>Check out Django REST framework's <a href="https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/compat.py">compat.py</a> for an example.</p>
2015-11-04 17:59:23 +03:00
<h3 id="once-your-package-is-available"><a class="toclink" href="#once-your-package-is-available">Once your package is available</a></h3>
2014-11-25 19:04:38 +03:00
<p>Once your package is decently documented and available on PyPI, you might want share it with others that might find it useful.</p>
2015-11-04 17:59:23 +03:00
<h4 id="adding-to-the-django-rest-framework-grid"><a class="toclink" href="#adding-to-the-django-rest-framework-grid">Adding to the Django REST framework grid</a></h4>
2014-11-25 19:04:38 +03:00
<p>We suggest adding your package to the <a href="https://www.djangopackages.com/grids/g/django-rest-framework/">REST Framework</a> grid on Django Packages.</p>
2015-11-04 17:59:23 +03:00
<h4 id="adding-to-the-django-rest-framework-docs"><a class="toclink" href="#adding-to-the-django-rest-framework-docs">Adding to the Django REST framework docs</a></h4>
2015-08-06 16:31:52 +03:00
<p>Create a <a href="https://github.com/tomchristie/django-rest-framework/compare">Pull Request</a> or <a href="https://github.com/tomchristie/django-rest-framework/issues/new">Issue</a> on GitHub, and we'll add a link to it from the main REST framework documentation. You can add your package under <strong>Third party packages</strong> of the API Guide section that best applies, like <a href="../../api-guide/authentication/">Authentication</a> or <a href="../../api-guide/permissions/">Permissions</a>. You can also link your package under the <a href="../../topics/third-party-resources/#existing-third-party-packages">Third Party Resources</a> section.</p>
2015-11-04 17:59:23 +03:00
<h4 id="announce-on-the-discussion-group"><a class="toclink" href="#announce-on-the-discussion-group">Announce on the discussion group.</a></h4>
2014-11-25 19:04:38 +03:00
<p>You can also let others know about your package through the <a href="https://groups.google.com/forum/#!forum/django-rest-framework">discussion group</a>.</p>
2015-11-04 17:59:23 +03:00
<h2 id="existing-third-party-packages"><a class="toclink" href="#existing-third-party-packages">Existing Third Party Packages</a></h2>
2014-11-25 19:04:38 +03:00
<p>Django REST Framework has a growing community of developers, packages, and resources.</p>
<p>Check out a grid detailing all the packages and ecosystem around Django REST Framework at <a href="https://www.djangopackages.com/grids/g/django-rest-framework/">Django Packages</a>.</p>
<p>To submit new content, <a href="https://github.com/tomchristie/django-rest-framework/issues/new">open an issue</a> or <a href="https://github.com/tomchristie/django-rest-framework/compare">create a pull request</a>.</p>
2015-11-04 17:59:23 +03:00
<h3 id="authentication"><a class="toclink" href="#authentication">Authentication</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/juanriaza/django-rest-framework-digestauth">djangorestframework-digestauth</a> - Provides Digest Access Authentication support.</li>
<li><a href="https://github.com/evonove/django-oauth-toolkit">django-oauth-toolkit</a> - Provides OAuth 2.0 support.</li>
<li><a href="https://github.com/Rediker-Software/doac">doac</a> - Provides OAuth 2.0 support.</li>
<li><a href="https://github.com/GetBlimp/django-rest-framework-jwt">djangorestframework-jwt</a> - Provides JSON Web Token Authentication support.</li>
<li><a href="https://github.com/kumar303/hawkrest">hawkrest</a> - Provides Hawk HTTP Authorization.</li>
<li><a href="https://github.com/etoccalino/django-rest-framework-httpsignature">djangorestframework-httpsignature</a> - Provides an easy to use HTTP Signature Authentication mechanism.</li>
<li><a href="https://github.com/sunscrapers/djoser">djoser</a> - Provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation.</li>
2015-03-06 15:05:16 +03:00
<li><a href="https://github.com/Tivix/django-rest-auth/">django-rest-auth</a> - Provides a set of REST API endpoints for registration, authentication (including social media authentication), password reset, retrieve and update user details, etc.</li>
<li><a href="https://github.com/ByteInternet/drf-oidc-auth">drf-oidc-auth</a> - Implements OpenID Connect token authentication for DRF.</li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="permissions"><a class="toclink" href="#permissions">Permissions</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/kevin-brown/drf-any-permissions">drf-any-permissions</a> - Provides alternative permission handling.</li>
<li><a href="https://github.com/niwibe/djangorestframework-composed-permissions">djangorestframework-composed-permissions</a> - Provides a simple way to define complex permissions.</li>
<li><a href="https://github.com/caxap/rest_condition">rest_condition</a> - Another extension for building complex permissions in a simple and convenient way.</li>
2015-08-06 16:31:52 +03:00
<li><a href="https://github.com/Helioscene/dry-rest-permissions">dry-rest-permissions</a> - Provides a simple way to define permissions for individual api actions.</li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="serializers"><a class="toclink" href="#serializers">Serializers</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/umutbozkurt/django-rest-framework-mongoengine">django-rest-framework-mongoengine</a> - Serializer class that supports using MongoDB as the storage layer for Django REST framework.</li>
<li><a href="https://github.com/djangonauts/django-rest-framework-gis">djangorestframework-gis</a> - Geographic add-ons</li>
<li><a href="https://github.com/djangonauts/django-rest-framework-hstore">djangorestframework-hstore</a> - Serializer class to support django-hstore DictionaryField model field and its schema-mode feature.</li>
2016-02-05 18:25:03 +03:00
<li><a href="https://github.com/django-json-api/django-rest-framework-json-api">djangorestframework-jsonapi</a> - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.</li>
<li><a href="https://github.com/wq/html-json-forms">html-json-forms</a> - Provides an algorithm and serializer to process HTML JSON Form submissions per the (inactive) spec.</li>
<li><a href="https://github.com/evenicoulddoit/django-rest-framework-serializer-extensions">django-rest-framework-serializer-extensions</a> -
Enables black/whitelisting fields, and conditionally expanding child serializers on a per-view/request basis.</li>
<li><a href="https://github.com/wimglenn/djangorestframework-queryfields">djangorestframework-queryfields</a> - Serializer mixin allowing clients to control which fields will be sent in the API response.</li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="serializer-fields"><a class="toclink" href="#serializer-fields">Serializer fields</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/estebistec/drf-compound-fields">drf-compound-fields</a> - Provides "compound" serializer fields, such as lists of simple values.</li>
<li><a href="https://github.com/Hipo/drf-extra-fields">django-extra-fields</a> - Provides extra serializer fields.</li>
<li><a href="https://github.com/WGBH/django-versatileimagefield">django-versatileimagefield</a> - Provides a drop-in replacement for Django's stock <code>ImageField</code> that makes it easy to serve images in multiple sizes/renditions from a single field. For DRF-specific implementation docs, <a href="https://django-versatileimagefield.readthedocs.io/en/latest/drf_integration.html">click here</a>.</li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="views"><a class="toclink" href="#views">Views</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/miki725/django-rest-framework-bulk">djangorestframework-bulk</a> - Implements generic view mixins as well as some common concrete generic views to allow to apply bulk operations via API requests.</li>
2015-08-06 16:31:52 +03:00
<li><a href="https://github.com/Axiologue/DjangoRestMultipleModels">django-rest-multiple-models</a> - Provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.</li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="routers"><a class="toclink" href="#routers">Routers</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/alanjds/drf-nested-routers">drf-nested-routers</a> - Provides routers and relationship fields for working with nested resources.</li>
<li><a href="http://wq.io/docs/about-rest">wq.db.rest</a> - Provides an admin-style model registration API with reasonable default URLs and viewsets.</li>
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="parsers"><a class="toclink" href="#parsers">Parsers</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/juanriaza/django-rest-framework-msgpack">djangorestframework-msgpack</a> - Provides MessagePack renderer and parser support.</li>
2016-02-05 18:25:03 +03:00
<li><a href="https://github.com/django-json-api/django-rest-framework-json-api">djangorestframework-jsonapi</a> - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.</li>
2014-11-25 19:04:38 +03:00
<li><a href="https://github.com/vbabiy/djangorestframework-camel-case">djangorestframework-camel-case</a> - Provides camel case JSON renderers and parsers.</li>
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="renderers"><a class="toclink" href="#renderers">Renderers</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/mjumbewu/django-rest-framework-csv">djangorestframework-csv</a> - Provides CSV renderer support.</li>
2016-02-05 18:25:03 +03:00
<li><a href="https://github.com/django-json-api/django-rest-framework-json-api">djangorestframework-jsonapi</a> - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.</li>
2014-11-25 19:04:38 +03:00
<li><a href="https://github.com/gizmag/drf-ujson-renderer">drf_ujson</a> - Implements JSON rendering using the UJSON package.</li>
<li><a href="https://github.com/wq/django-rest-pandas">rest-pandas</a> - Pandas DataFrame-powered renderers including Excel, CSV, and SVG formats.</li>
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="filtering"><a class="toclink" href="#filtering">Filtering</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="https://github.com/philipn/django-rest-framework-chain">djangorestframework-chain</a> - Allows arbitrary chaining of both relations and lookup filters.</li>
2015-09-11 15:06:48 +03:00
<li><a href="https://github.com/miki725/django-url-filter">django-url-filter</a> - Allows a safe way to filter data via human-friendly URLs. It is a generic library which is not tied to DRF but it provides easy integration with DRF.</li>
<li><a href="https://github.com/manjitkumar/drf-url-filters">drf-url-filter</a> is a simple Django app to apply filters on drf <code>ModelViewSet</code>'s <code>Queryset</code> in a clean, simple and configurable way. It also supports validations on incoming query params and their values.</li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="misc"><a class="toclink" href="#misc">Misc</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
2015-10-28 14:35:39 +03:00
<li><a href="https://github.com/agconti/cookiecutter-django-rest">cookiecutter-django-rest</a> - A cookiecutter template that takes care of the setup and configuration so you can focus on making your REST apis awesome.</li>
2014-11-25 19:04:38 +03:00
<li><a href="https://github.com/fredkingham/django_rest_model_hyperlink_serializers_project">djangorestrelationalhyperlink</a> - A hyperlinked serialiser that can can be used to alter relationships via hyperlinks, but otherwise like a hyperlink model serializer.</li>
<li><a href="https://github.com/marcgibbons/django-rest-swagger">django-rest-swagger</a> - An API documentation generator for Swagger UI.</li>
<li><a href="https://github.com/eofs/django-rest-framework-proxy">django-rest-framework-proxy</a> - Proxy to redirect incoming request to another API server.</li>
2015-08-06 16:31:52 +03:00
<li><a href="https://github.com/AppsFuel/gaiarestframework">gaiarestframework</a> - Utils for django-rest-framework</li>
2014-11-25 19:04:38 +03:00
<li><a href="https://github.com/chibisov/drf-extensions">drf-extensions</a> - A collection of custom extensions</li>
2015-02-11 01:56:05 +03:00
<li><a href="https://github.com/dustinfarris/ember-django-adapter">ember-django-adapter</a> - An adapter for working with Ember.js</li>
<li><a href="https://github.com/WGBH/django-versatileimagefield">django-versatileimagefield</a> - Provides a drop-in replacement for Django's stock <code>ImageField</code> that makes it easy to serve images in multiple sizes/renditions from a single field. For DRF-specific implementation docs, <a href="https://django-versatileimagefield.readthedocs.io/en/latest/drf_integration.html">click here</a>.</li>
2015-06-04 17:37:22 +03:00
<li><a href="https://github.com/aschn/drf-tracking">drf-tracking</a> - Utilities to track requests to DRF API views.</li>
<li><a href="https://github.com/ArabellaTech/drf_tweaks">drf_tweaks</a> - Serializers with one-step validation (and more), pagination without counts and other tweaks.</li>
<li><a href="https://github.com/dealertrack/django-rest-framework-braces">django-rest-framework-braces</a> - Collection of utilities for working with Django Rest Framework. The most notable ones are <a href="https://django-rest-framework-braces.readthedocs.io/en/latest/overview.html#formserializer">FormSerializer</a> and <a href="https://django-rest-framework-braces.readthedocs.io/en/latest/overview.html#serializerform">SerializerForm</a>, which are adapters between DRF serializers and Django forms.</li>
<li><a href="https://drf-haystack.readthedocs.io/en/latest/">drf-haystack</a> - Haystack search for Django Rest Framework</li>
2015-11-04 17:59:23 +03:00
<li><a href="https://github.com/mrhwick/django-rest-framework-version-transforms">django-rest-framework-version-transforms</a> - Enables the use of delta transformations for versioning of DRF resource representations.</li>
2016-05-26 13:48:39 +03:00
<li><a href="https://github.com/raphaelgyory/django-rest-messaging">django-rest-messaging</a>, <a href="https://github.com/raphaelgyory/django-rest-messaging-centrifugo">django-rest-messaging-centrifugo</a> and <a href="https://github.com/raphaelgyory/django-rest-messaging-js">django-rest-messaging-js</a> - A real-time pluggable messaging service using DRM.</li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h2 id="other-resources"><a class="toclink" href="#other-resources">Other Resources</a></h2>
<h3 id="tutorials"><a class="toclink" href="#tutorials">Tutorials</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="http://code.tutsplus.com/tutorials/beginners-guide-to-the-django-rest-framework--cms-19786">Beginner's Guide to the Django Rest Framework</a></li>
<li><a href="http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html">Getting Started with Django Rest Framework and AngularJS</a></li>
<li><a href="http://mourafiq.com/2013/07/01/end-to-end-web-app-with-django-angular-1.html">End to end web app with Django-Rest-Framework &amp; AngularJS</a></li>
2014-11-25 19:04:38 +03:00
<li><a href="https://godjango.com/41-start-your-api-django-rest-framework-part-1/">Start Your API - django-rest-framework part 1</a></li>
<li><a href="https://godjango.com/43-permissions-authentication-django-rest-framework-part-2/">Permissions &amp; Authentication - django-rest-framework part 2</a></li>
<li><a href="https://godjango.com/45-viewsets-and-routers-django-rest-framework-part-3/">ViewSets and Routers - django-rest-framework part 3</a></li>
<li><a href="http://richardtier.com/2014/02/25/django-rest-framework-user-endpoint/">Django Rest Framework User Endpoint</a></li>
<li><a href="http://richardtier.com/2014/03/06/110/">Check credentials using Django Rest Framework</a></li>
<li><a href="https://teamtreehouse.com/library/django-rest-framework">Django REST Framework course</a></li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="videos"><a class="toclink" href="#videos">Videos</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="http://www.neckbeardrepublic.com/screencasts/ember-and-django-part-1">Ember and Django Part 1 (Video)</a></li>
<li><a href="http://www.neckbeardrepublic.com/screencasts/django-rest-framework-part-1">Django Rest Framework Part 1 (Video)</a></li>
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="articles"><a class="toclink" href="#articles">Articles</a></h3>
2014-11-25 19:04:38 +03:00
<ul>
<li><a href="http://dabapps.com/blog/api-performance-profiling-django-rest-framework/">Web API performance: profiling Django REST framework</a></li>
<li><a href="https://bnotions.com/api-development-with-django-and-django-rest-framework/">API Development with Django and Django REST Framework</a></li>
2016-05-26 13:48:39 +03:00
<li><a href="https://medium.com/django-rest-framework">Blog posts about Django REST framework</a></li>
2014-11-25 19:04:38 +03:00
</ul>
2015-11-04 17:59:23 +03:00
<h3 id="documentations"><a class="toclink" href="#documentations">Documentations</a></h3>
2015-06-04 17:37:22 +03:00
<ul>
<li><a href="http://www.cdrf.co">Classy Django REST Framework</a></li>
</ul>
2015-05-15 11:19:49 +03:00
2015-06-23 14:05:53 +03:00
</div> <!--/span-->
</div> <!--/row-->
</div> <!--/.fluid-container-->
</div> <!--/.body content-->
2014-11-25 19:04:38 +03:00
<div id="push"></div>
2015-06-23 14:05:53 +03:00
</div> <!--/.wrapper -->
2014-11-25 19:04:38 +03:00
<footer class="span12">
2015-10-28 14:35:39 +03:00
<p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.
2014-11-25 19:04:38 +03:00
</p>
</footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../../js/jquery-1.8.1-min.js"></script>
<script src="../../js/prettify-1.0.js"></script>
<script src="../../js/bootstrap-2.1.1-min.js"></script>
2016-05-26 13:48:39 +03:00
<script src="https://fund.django-rest-framework.org/sidebar_include.js"></script>
2015-06-04 17:37:22 +03:00
<script>var base_url = '../..';</script>
<script src="../../mkdocs/js/require.js"></script>
2014-12-11 12:55:10 +03:00
<script src="../../js/theme.js"></script>
2014-11-25 19:04:38 +03:00
<script>
var shiftWindow = function() {
scrollBy(0, -50)
};
2015-06-23 14:05:53 +03:00
2014-11-25 19:04:38 +03:00
if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);
$('.dropdown-menu').on('click touchstart', function(event) {
event.stopPropagation();
});
2015-06-23 14:05:53 +03:00
// Dynamically force sidenav/dropdown to no higher than browser window
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
2014-11-25 19:04:38 +03:00
$(function() {
$(window).resize(function() {
2015-06-23 14:05:53 +03:00
$('.side-nav, .dropdown-menu').css('max-height', window.innerHeight - 130);
2014-11-25 19:04:38 +03:00
});
});
</script>
</body>
</html>