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

231
Visualizações
render() takes exactly 2 arguments (1 given)

I am getting the error "render() takes exactly 2 arguments (1 given)" after migrating my application to new server. Here is content of my urls.py file:

urlpatterns = [
    url(r'^admin/', admin.site.urls),
        url(r'^warlist/', include('warlist.urls')),
        url(r'^warlist/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}),
]

and in my views.py i am doing below:

 template = loader.get_template('warlist/index.html')
 image = loader.get_template('warlist/image.html')
 table = loader.get_template('warlist/welcomepage_table.html')
 info = loader.get_template('warlist/info.html')
 return HttpResponse(image.render()+ template.render()+info.render()+table.render()+info_str+table_str)

The above application is working fine in my old server with given code.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

When you call render():

 return HttpResponse(image.render()+ template.render()+info.render()+table.render()+info_str+table_str)

You need to pass the context into the render() method.

over 4 years ago · Santiago Trujillo Relatório

0

It means that .render() expects an argument. The 1 given is the object on which you call the method. For instance image.render() will have the definition def render(self, argument): where the self is the image object on which you call the method.

over 4 years ago · Santiago Trujillo Relatório

0

render takes something like this

return render(request,'template_name.html',context)

if you are trying to use HttpResponse. create one html file and the rest you want to include, include them like this include('addition.html') in your 'template_name.html' and then return the HttpResponse.

over 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