Setting up the project
Before we start writing code, let’s get the starter project running on your computer.
1. Get the code
Clone the repository and move into the project folder:
git clone https://github.com/preludetech/tutorial-modern-web-frontends-no-react.git
cd tutorial-modern-web-frontends-no-react2. Install uv
We use uv to manage Python and our dependencies. Follow the uv installation instructions for your operating system.
Check that it worked:
uv --version3. Install the Python packages
This downloads all the Python dependencies and sets up a virtual environment for you:
uv sync4. Install Playwright’s browsers
We’ll use Playwright towards the end of the tutorial. It drives real browsers, so it needs to download them first:
uv run playwright installPlaywright might tell you that your system is missing some dependencies. If it does, it will also tell you the command to install them.
Check that everything works by running the tests:
uv run pytestYou should see 1 passed.
5. Set up the database
We’re using SQLite, so there is no database server to install. First, create the tables:
uv run python manage.py migrateThen add some example todo items:
uv run python manage.py add_todosIf you ever want to start over with a fresh list, delete all the todos and add them again:
uv run python manage.py delete_todos
uv run python manage.py add_todos6. Run the development server
uv run python manage.py runserverNow open http://127.0.0.1:8000/ in your browser. You should see a todo list with the heading “Get this done”.
The project uses django-browser-reload, so the page will refresh automatically whenever you save a template or Python file. Keep the server running while you work through the tutorial.
What to expect
The app looks nice enough, but it isn’t finished yet. Try it out:
- You can add a new todo item using the form at the bottom of the page.
- You can tick a checkbox, but nothing gets saved. Refresh the page and your tick is gone.
- Done items aren’t sorted to the bottom of the list.
- Every item’s description is always visible.
- There are no tests for any of the app’s behaviour.
Each of these is one of the goals in this tutorial. By the end, they’ll all be fixed.