Search code examples
pythondjangoreactjswebpackdjango-webpack-loader

'webpack_loader' is not a registered tag library


I am starting to learn some react, and trying to learn how to combine ReactJS and Django. I am currently following the proposed tutorial here

After setting up the django urls, and installing django-webpack-loader, I am stuck with the following error when running the django server:

TemplateSyntaxError at /

'webpack_loader' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_static
admin_urls
cache
i18n
l10n
log
static
staticfiles
tz

My current index.html is as follows:

{% load render_bundle from webpack_loader %}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Ponynote</title>
  </head>
  <body>
    <div id="root">
    </div>
      {% render_bundle 'main' %}
  </body>
</html>

I already tried going on, and setting up the rest, but nothing seems to work. The error I am getting is different from the one in the tutorial and both in the github page of django-webpack-loader package and here I can't see any problem like this. The solutions for similar errors I found here did not solve my problems, so I am not sure what or where the error is lying.

I tried:

  • Literally copy-pasting the tutorial code
  • remaking the entire project
  • several solutions like creating a custom tag
  • checking if the react(webpack) server is running

Info:

Django version 2.0.5
django-webpack-loader==0.6.0
Python version 3.6.5
Running on Ubuntu x64 18.04 LTS

Thanks for any help, and sorry if this is a stupid, simple to solve mistake.


Solution

  • You must add webpack_loader to your INSTALLED_APPS as described in the tutorial:

    Then in the project settings.py (ponynote.settings) add webpack_loader in INSTALLED_APPS list and add the following [...]`