Hosted by Rubberdøk
Demo repo used in crash course for students learning web development. Contains a basic React frontend and Django backend for creating and showing todos.
Table of Contents
Following these steps prepares you to join the interactive demos of the crash course. If you have any trouble with the preparation, please file an issue.
- Download and install
Node.js
from https://nodejs.org/en/- Select the "Recommended For Most Users" option
- Find the terminal on your computer
- Mac:
Terminal
- Windows:
Powershell
/Command Prompt
/Windows Terminal
- Mac:
- Open the terminal, and check that Node was installed correctly by typing
npm --version
- If
npm
is not recognized, try restarting your computer. If it still does not work, try following these steps for Windows, or these for Mac.
- If
- Type
npx create-react-app react-demo --template typescript
in the terminalnpx
this time, notnpm
!- If prompted to install
create-react-app
, typey
. - This creates a React app called
react-demo
. - If you're on a Mac, you may be prompted to install Command Line Developer Tools. Do it!
- Type
cd react-demo
to move to the newreact-demo
subfolder - Type
npm start
- After some setup, this should open a browser tab with your app! Now you're all set for the interactive demo.
- Download and install Python from https://www.python.org/ (if you don't already have it)
- Find the terminal on your computer
- Mac:
Terminal
- Windows:
Powershell
/Command Prompt
/Windows Terminal
- Mac:
- Open the terminal, and check that Python was installed correctly by typing
python3 --version
- Type
mkdir django-demo
to make a folder for the project - Type
cd django-demo
to move into the folder - Type
pip install Django==3.2.14 graphene-django==2.15.0
to install Django and Graphene - Type
django-admin startproject config .
(don't miss the.
!) to set up the Django project with aconfig
module - Type
python3 manage.py startapp todos
to create a Django app for todos - Type
python3 manage.py runserver
to run the server - Open a new terminal window (and leave the previous one running!)
- Type
cd django-demo
again in the new terminal window, to get back to the project - Type
python3 manage.py migrate
to initialize the database
I recommend everyone to install VSCode as your code editor:
- Download and install from https://code.visualstudio.com/
- Launch it
- Go to
File -> Open Folder
- Find the
react-demo
/django-demo
folder (depending on which project you want to open), and double-click it. If you made it from a fresh terminal window earlier, it should be located in:- Mac:
/Users/[your username]/[react-demo/django-demo]
(pressCommand + Shift + H
and you should see it) - Windows:
C:\Users\[your username]\[react-demo/django-demo]
- Mac:
- Now you should see your React/Django files on the left in VSCode. Next time you open VSCode, you'll enter right into this folder and be ready to join the demo!
react-demo
contains a simple React todo app used for the interactive demo.django-demo/backend
contains a simple Django backend for todos, with a GraphQL API using Graphene.django-demo/frontend
is a copy ofreact-demo
, but now connected to the Django backend to fetch and create todos.slides
contains the presentation slides from the crash course (in Norwegian, since the course has been held for students in Trondheim)