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

230
Views
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 answers
Answer question

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 Report

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 Report

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 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!