Browse Source

inicia configuração do drf docs

pull/2465/head
Leandro Roberto 6 years ago
parent
commit
6ed53de9fc
  1. 3
      requirements/requirements.txt
  2. 9
      sapl/api/urls.py
  3. 4
      sapl/settings.py

3
requirements/requirements.txt

@ -14,6 +14,7 @@ django-speedinfo==1.4.0
django-extensions==2.1.4
django-image-cropping==1.2
django-webpack-loader==0.6.0
django-rest-swagger==2.2.0
easy-thumbnails==2.5
python-decouple==3.1
psycopg2-binary==2.7.6.1
@ -30,7 +31,7 @@ pysolr==3.6.0
whoosh==2.7.4
git+git://github.com/interlegis/trml2pdf.git
git+git://github.com/jasperlittle/django-rest-framework-docs
#git+git://github.com/jasperlittle/django-rest-framework-docs
git+git://github.com/interlegis/django-admin-bootstrapped
#django-compressor==2.2

9
sapl/api/urls.py

@ -2,6 +2,8 @@ from django.conf import settings
from django.conf.urls import include, url
from rest_framework.routers import DefaultRouter
from rest_framework_swagger.views import get_swagger_view
from sapl.api.views import (AutoresPossiveisListView, AutoresProvaveisListView,
AutorListView, MateriaLegislativaViewSet,
ModelChoiceView, SessaoPlenariaViewSet,
@ -39,9 +41,10 @@ urlpatterns_api = [
]
if settings.DEBUG:
urlpatterns_api += [
url(r'^docs', include('rest_framework_docs.urls')), ]
schema_view = get_swagger_view(title='Pastebin API')
urlpatterns_api += [
url(r'^docs', schema_view), ]
urlpatterns = [
url(r'^api/', include(urlpatterns_api)),

4
sapl/settings.py

@ -81,6 +81,7 @@ INSTALLED_APPS = (
'crispy_forms',
'floppyforms',
'rest_framework_swagger',
'rest_framework',
'django_filters',
@ -139,7 +140,7 @@ MIDDLEWARE = [
'speedinfo.middleware.ProfilerMiddleware',
]
if DEBUG:
INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',)
INSTALLED_APPS += ('debug_toolbar', )
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
INTERNAL_IPS = ('127.0.0.1')
@ -159,6 +160,7 @@ REST_FRAMEWORK = {
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.BrowsableAPIRenderer',
),
"DEFAULT_PERMISSION_CLASSES": (
"sapl.api.permissions.SaplModelPermissions",

Loading…
Cancel
Save