Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

313
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda