The react frontend application folder replaces the default templates folder from which Django is meant to locate and load templates which would normally be specified in this format 'DIRS': [BASE_DIR/ 'templates'].
However, since we want the Django backend to make use of a react frontend while using a single server: http://127.0.0.1:8000, we need to point Django to the folder where it will get the frontend files which in the tutorial above is the build folder in the frontend directory. Hence the necessity for the STATICFILES_DIRS = [os.path.join(BASE_DIR, 'frontend', 'build', 'static')] line.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hello Bernard. Here is a screenshot of the folder structure for the tutorial: dev-to-uploads.s3.amazonaws.com/up...
The react frontend application folder replaces the default templates folder from which Django is meant to locate and load templates which would normally be specified in this format
'DIRS': [BASE_DIR/ 'templates']
.However, since we want the Django backend to make use of a react frontend while using a single server:
http://127.0.0.1:8000
, we need to point Django to the folder where it will get the frontend files which in the tutorial above is thebuild
folder in the frontend directory. Hence the necessity for theSTATICFILES_DIRS = [os.path.join(BASE_DIR, 'frontend', 'build', 'static')]
line.