DEV Community

Discussion on: How to Serve a React Single-Page App with Django

Collapse
 
samar08 profile image
Samar • Edited

I have followed the entire article as it is. But i am getting the below mentioned error. Does anyone know how to fix it?

django-react-starter\frontend\templates\frontend\index.html, error at line 11
Exception Value:

expected string or bytes-like object

8

9



10

11 ... render_bundle 'frontend' ..

12

13
Collapse
 
matt_b1f8ccb21f55eb profile image
matt_b1f8ccb21f55eb • Edited

UPDATE: I did end up solving this, but I'm leaving my original message up. See below for the fix.

Hey @samar08 I'm receiving the same error. I've been trying to find a solution for a couple of days now and I'm coming up empty. I wasn't sure if it was a version thing or not. I'm using Python 3.9 and Django 4, but I tried Django 3 and had the same error. Are you using Python 3.9 or a different version? The babel and webpack versions I'm using seem to be releases from 2021 or earlier, so I don't think it's that. Have you solved it yet?

EDIT: I solved it! I had a newer version of webpack that was causing the issue. Python 3.9 and Django 4 seem to work fine so far.

pip uninstall django-webpack-loader
pip install django-webpack-loader==0.7.0