InvalidTemplateEngineError in oscar

80 Views Asked by At

I am using django-oscar for my development. I have created a new app as per my requirement

views.py

class MediaImportView(TemplateView):
  template_name = 'lookup/import_media_file.html'

  def get(self, request):
    ctx = {}
    return render(self.template_name, ctx, request, using=request)

getting the error as below.

InvalidTemplateEngineError at /import_media_file

Could not find config for '<WSGIRequest: GET '/import_media_file'>' in settings.TEMPLATES

1

There are 1 best solutions below

0
On

From the documentation, the using argument takes:

The NAME of a template engine to use for loading the template.

Instead of passing the name of a template engine, you are passing a request object, hence the error. In addition, all your other arguments are wrong as well - the signature of this function is:

render(request, template_name, context=None, content_type=None, status=None, using=None)

So the first argument needs to be a request, the second a template name, and the third the context. Something like this:

return render(request, self.template_name, ctx)