Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e501b04

Browse files
n2ygkmblayman
authored andcommitted
Issue 410 (#411)
* Make documented example runserver work Resolves #410: docs/getting-started.md example doesn't work. * xGet the steps right in the documentation to run the example app. * First attempt at for issue #410 didn't have includes sorted properly. - travis caught it. This time I've done the isort locally to confirm the order. - MIDDLEWARE_CLASSES was replaced by MIDDLEWARE as of Django 1.10 and, according to tox.ini, this is only testing >=1.11. * missed a line which flake8 caught * add back install of this package * add myself as an author as requested
1 parent 4ef5bb4 commit e501b04

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

‎AUTHORS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Adam Wróbel <https://adamwrobel.com>
22
Adam Ziolkowski <adam@adsized.com>
3+
Alan Crosswell <alan@columbia.edu>
34
Christian Zosel <https://zosel.ch>
45
Greg Aker <greg@gregaker.net>
56
Jamie Bliss <astronouth7303@gmail.com>

‎docs/getting-started.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,18 @@ From Source
7070

7171
git clone https://github.com/django-json-api/django-rest-framework-json-api.git
7272
cd django-rest-framework-json-api
73-
pip install -e .
73+
python -m venv env
74+
source env/bin/activate
7475
pip install -r example/requirements.txt
75-
django-admin.py runserver
76+
pip install -e .
77+
django-admin.py startproject example .
78+
python manage.py migrate
79+
python manage.py runserver
7680

7781
Browse to http://localhost:8000
7882

7983
## Running Tests
8084

81-
python runtests.py
85+
pip install tox
86+
tox
8287

‎example/requirements.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
# Requirements specifically for the example app
22
packaging
3+
Django>=1.11
4+
django-debug-toolbar
5+
django-polymorphic>=2.0
6+
djangorestframework
7+
inflection
8+
pluggy
9+
py
10+
pyparsing
11+
pytz
12+
six
13+
sqlparse

‎example/settings/dev.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
PASSWORD_HASHERS = ('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher', )
6161

62-
MIDDLEWARE_CLASSES = (
62+
MIDDLEWARE = (
6363
'debug_toolbar.middleware.DebugToolbarMiddleware',
6464
)
6565

‎example/urls.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,47 @@
33
from rest_framework import routers
44

55
from example.views import (
6+
AuthorRelationshipView,
67
AuthorViewSet,
8+
BlogRelationshipView,
79
BlogViewSet,
10+
CommentRelationshipView,
811
CommentViewSet,
912
CompanyViewset,
13+
EntryRelationshipView,
1014
EntryViewSet,
15+
NonPaginatedEntryViewSet,
1116
ProjectViewset
1217
)
1318

1419
router = routers.DefaultRouter(trailing_slash=False)
1520

1621
router.register(r'blogs', BlogViewSet)
1722
router.register(r'entries', EntryViewSet)
23+
router.register(r'nopage-entries', NonPaginatedEntryViewSet, 'nopage-entry')
1824
router.register(r'authors', AuthorViewSet)
1925
router.register(r'comments', CommentViewSet)
2026
router.register(r'companies', CompanyViewset)
2127
router.register(r'projects', ProjectViewset)
2228

2329
urlpatterns = [
2430
url(r'^', include(router.urls)),
31+
url(r'^entries/(?P<entry_pk>[^/.]+)/suggested/',
32+
EntryViewSet.as_view({'get': 'list'}),
33+
name='entry-suggested'
34+
),
35+
url(r'^entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
36+
EntryRelationshipView.as_view(),
37+
name='entry-relationships'),
38+
url(r'^blogs/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
39+
BlogRelationshipView.as_view(),
40+
name='blog-relationships'),
41+
url(r'^comments/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
42+
CommentRelationshipView.as_view(),
43+
name='comment-relationships'),
44+
url(r'^authors/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
45+
AuthorRelationshipView.as_view(),
46+
name='author-relationships'),
2547
]
2648

2749

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /