Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

315
Vistas
How to integrate django-rest-swagger 2.0 with existing DRF application(Beginner)

I am trying to integrate swagger 2.0 with existing DRF application but it gives following error in browser after runningpython manage.py runserver:

TemplateDoesNotExist at /swagger rest_framework_swagger/index.html Request Method: GET Request URL: http://127.0.0.1:8000/swagger Django Version: 1.10 Exception Type: TemplateDoesNotExist Exception Value: rest_framework_swagger/index.html Exception Location: C:\Users\MHAZIQ~1\Desktop\Tkxel\mmg-git\venv\lib\site-packages\django\template\loader.py in get_template, line 25

I have added following lines in views.py:

from rest_framework_swagger.views import get_swagger_view

schema_view = get_swagger_view(title='Pastebin API')

And I have added following lines in urls.py:

url(r'^swagger', views.schema_view),

I ve tried applying following solution: TemplateDoesNotExist at /docs/ rest_framework_swagger/index.html

but it didnot solve my problem, Can anyone please help me in this regard?

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Add 'rest_framework_swagger' to INSTALLED_APPS in Django settings.

settings.py

  INSTALLED_APPS = [
    ...
        'rest_framework_swagger',
    ]

https://django-rest-swagger.readthedocs.io/en/latest/

about 4 years ago · Santiago Trujillo Denunciar

0

After several hours of research I have found the problem with my code, as I was adding swagger into an existing project, it didnt have following parameters in settings.py:

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [],
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
        ],
    },
},]

Now swagger works absolutely fine!

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda