> For the complete documentation index, see [llms.txt](https://developers.laws.africa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.laws.africa/tutorials/module-1-build-a-legislation-reader/create-a-basic-django-app.md).

# Create a basic Django app

## In this section

* Setup a Python environment
* Create a basic Django app

## Create a basic Django app

We will build our example application using Django. There is nothing special about using Django, you can easily build an equivalent application using another language and framework.

Follow the first steps for setting up a Django app using the [Django tutorial](https://docs.djangoproject.com/en/3.2/intro/tutorial01/), using `legislation` and `reader` for your project and app, respectively.

{% hint style="warning" %}
Ignore the instruction to create a `urls.py` file in your `reader` app; we'll cover these in [Expression detail page](/tutorials/module-1-build-a-legislation-reader/expression-detail-page.md).
{% endhint %}

Here is a summary of the commands to run:

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install django==3.2
pip install requests
django-admin startproject legislation
cd legislation

python manage.py startapp reader
# see Create database models
python manage.py makemigrations reader
python manage.py migrate

# see Fetching the data
python manage.py ingest_capetown_bylaws <YOUR_AUTH_TOKEN>
python manage.py runserver
```

We'll use the default settings, adding `legislation` and `reader` to the the list of installed apps:

{% code title="settings.py" %}

```python
INSTALLED_APPS = [
    'legislation',
    'reader',
    'django.contrib.admin',
    ...
]
```

{% endcode %}

Instead of creating objects manually to play with, as they do in the [Django tutorial](https://docs.djangoproject.com/en/3.2/intro/tutorial02/#playing-with-the-api), we'll ingest some live data from the publicly available Indigo API in [Fetching the data](/tutorials/module-1-build-a-legislation-reader/fetching-the-data.md).

We won't cover the [Django Admin](https://docs.djangoproject.com/en/3.2/intro/tutorial02/#introducing-the-django-admin) in this tutorial, but you might find it useful.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.laws.africa/tutorials/module-1-build-a-legislation-reader/create-a-basic-django-app.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
