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.jsfrom 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
npmis 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 typescriptin the terminalnpxthis 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-demoto move to the newreact-demosubfolder - 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-demoto make a folder for the project - Type
cd django-demoto move into the folder - Type
pip install Django==3.2.14 graphene-django==2.15.0to install Django and Graphene - Type
django-admin startproject config .(don't miss the.!) to set up the Django project with aconfigmodule - Type
python3 manage.py startapp todosto create a Django app for todos - Type
python3 manage.py runserverto run the server - Open a new terminal window (and leave the previous one running!)
- Type
cd django-demoagain in the new terminal window, to get back to the project - Type
python3 manage.py migrateto 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-demofolder (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 + Hand 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-democontains a simple React todo app used for the interactive demo.django-demo/backendcontains a simple Django backend for todos, with a GraphQL API using Graphene.django-demo/frontendis a copy ofreact-demo, but now connected to the Django backend to fetch and create todos.slidescontains the presentation slides from the crash course (in Norwegian, since the course has been held for students in Trondheim)