![]() |
VOOZH | about |
Sr Technical Content Strategist and Team Lead
In this tutorial, you will build a To-Do application using Django and React.
React is a JavaScript framework for developing SPAs (single-page applications). It has solid documentation and a vibrant ecosystem around it.
Django is a Python web framework that simplifies common practices in web development. Django is reliable and also has a vibrant ecosystem of stable libraries supporting common development needs.
For this application, React serves as the frontend, or client-side framework, handling the user interface and getting and setting data via requests to the Django backend, which is an API built using the Django REST framework (DRF).
At the end of this tutorial, you will have a fully working application:
If you want to deploy the app in this tutorial, you can deploy directly from a GitHub repo using DigitalOcean App Platform.
This application will allow users to create tasks and mark them as complete or incomplete.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
I help Businesses scale with AI x SEO x (authentic) Content that revives traffic and keeps leads flowing | 3,000,000+ Average monthly readers on Medium | Sr Technical Writer(Team Lead) @ DigitalOcean | Ex-Cloud Consultant @ AMEX | Ex-Site Reliability Engineer(DevOps)@Nutanix
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Ran into this error,
“?: (corsheaders.E013) Origin ‘localhost:3000/’ in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).”
The fix for this is to remove the trailing ‘/’ and prefix the "http://’ before local host. After making this change in the backend\settings.py file in the ‘CORS_ORIGIN_WHITELIST’ section, this worked for me.
Also, you need a ‘,’ at the end of the item “http://localhost:8000” in the CORS_ORIGIN_WHITELIST list
How to deploy this to DigitalOcean?
Great tutorial.
I have a couple of questions being a total noob.
What is the difference between the method definitions and the arrow functions in a class in javascript? They both appear to act as method functions, is there a scope difference or something?
And for the Input and Label tags in Modal.js, you seemed to have mapped the “for” attribute in Label and the “name” attribute in Input. Did you deliberately omit the “id” attribute because you didn’t want the effect?
great article, thanks a lot !! If you ran into the error “?: (corsheaders.E013) Origin ‘localhost:3000/’ in CORSORIGINWHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).” Same as bellow try this
CORS_ORIGIN_WHITELIST = [
'https://localhost:3000'
]
Today I learn that django care about the brackets !
You added localhost:8000 as a proxy and you mentioned the purpose of it. However, you still left it in your axios requests
I believe you’ll be getting forbidden requests unless you include CSRF tokens as well.
you already used npm to create the react app. Why are you suddenly using yarn? The tutorial gets very confusing when it’s just blindly copy/pasting code.
After registering todo app then run command::python manage.py createsuperuser Got errors- <class ‘todo.admin.TodoAdmin’>: (admin.E108) The value of ‘list_display[2]’ refers to ‘completed’, which is not a callable, an attribute of ‘TodoAdmin’, or an attribute or method on ‘todo.Todo’.
Please help me to resolve this
Hi, thank you for this tutorial.
I completed the exercise but I am getting “Forbidden” messages when I try to DELETE. How can I fix this part?
Also, what can I do to refresh the GUI after any operation. For example, I would like if after checking a TODO task “complete”, it will immediately disappear from the list of incomplete tasks.
How to deploy these 2 app at once
I managed to get past the CORSORIGINWHITELIST error and a couple of others, but from the point at which I edit the src/App.js file I am stuck with the default React screen no matter what I do. Does anyone know what I might have missed? Environment is an Ubuntu PC, everything on the BASH terminal and using Chromium and Firefox as browsers.
Had to import bootstrap explicitly like so:
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
otherwise bootstrap wouldn’t load.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.