Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

307
Views
Cómo integrar django-rest-swagger 2.0 con la aplicación DRF existente (Principiante)

Estoy tratando de integrar swagger 2.0 con la aplicación DRF existente, pero da el siguiente error en el navegador después de ejecutar python manage.py runserver :

TemplateDoesNotExist en /swagger rest_framework_swagger/index.html Método de solicitud: GET URL de solicitud: http://127.0.0.1:8000/swagger Versión de Django: 1.10 Tipo de excepción: TemplateDoesNotExist Valor de excepción: rest_framework_swagger/index.html Ubicación de excepción: C:\Users \MHAZIQ~1\Desktop\Tkxel\mmg-git\venv\lib\site-packages\django\template\loader.py en get_template, línea 25

He agregado las siguientes líneas en views.py:

from rest_framework_swagger.views import get_swagger_view

schema_view = get_swagger_view(title='Pastebin API')

Y he agregado las siguientes líneas en urls.py:

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

Intenté aplicar la siguiente solución: TemplateDoesNotExist en /docs/rest_framework_swagger/index.html

pero no resolvió mi problema, ¿alguien puede ayudarme en este sentido?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Agregue 'rest_framework_swagger' a INSTALLED_APPS en la configuración de Django.

configuración.py

 INSTALLED_APPS = [ ... 'rest_framework_swagger', ]

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

about 4 years ago · Santiago Trujillo Report

0

Después de varias horas de investigación, encontré el problema con mi código, ya que estaba agregando swagger a un proyecto existente, no tenía los siguientes parámetros en 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', ], }, },]

¡Ahora swagger funciona absolutamente bien!

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!