<!-- vi: tw=119
-->

# `vuln_demo` project directory

This directory hosts the root of the **Django project**[^1], and is responsible for all logic powering the website.

The project is structured into the following directories:

- [`apps`](./apps) contains the **Django apps**, which are the building blocks that make up this Django project. A
  Django project must always consist of one or more apps, and these apps can be made completely modular and reusable
  across any Django project. In this project, each app controls a distinct part of the website.

  For more information on reusable apps, see the official Django tutorial, specifically the [section on reusable
  apps](https://docs.djangoproject.com/en/dev/intro/reusable-apps/). To learn more about our specific apps, see the
  README inside the app folder itself.

- [`static`](./static) contains our **static files**, such as CSS, JavaScript, images, and anything else that isn't
  either content or Python code.

  Static files specific to a single application are stored in a subdirectory named after that application.

- [`templates`](./templates) contains our **[Django
  templates](https://docs.djangoproject.com/en/dev/topics/templates/)**.

  Like with static files, templates specific to a single application are stored in a subdirectory named after that
  application.

  We also have two special templates here:

  - `404.html`, which is the error page shown when a site was not found.
  - `500.html`, which is the error page shown in the astronomically rare case that we encounter an internal server
    error.

- [`util`](./util) contains some utility functionalities shared across all apps, or used in one of the files directly
  in this directory.

Note that for both `static` and `templates`, we are not using the default Django directory structure, which puts these
directories in a directory per app (in our case, this would for example me `vuln_demo/apps/general/static/`).

We also have a few files in this directory that are relevant or useful in large parts of the website:

- [`settings.py`](./settings.py), our Django settings file. This controls all manner of crucial things, for instance,
  it's used to configure logging, the database connection, which applications are run by the project, which middlewares
  are being used, and some other things.

- [`urls.py`](./urls.py), the URL configuration for the project itself. Here we can forward certain URL paths to our
  different apps, which have their own `urls.py` files to configure where their subpaths will lead. These files
  determine _which URLs will lead to which Django views_.

- [`wsgi.py`](./wsgi.py), which serves as an adapter for [`gunicorn`](https://github.com/benoitc/gunicorn),
  [`uwsgi`](https://github.com/unbit/uwsgi), or other application servers to run our application in production. Unless
  you want to test an interaction between our application and those servers, you probably don't need to touch this.

For more information about contributing to this project, please read the [contributing guide](../CONTRIBUTING.md), and
of course the project [README](../README.md).

[^1]: See [Django Glossary: project](https://docs.djangoproject.com/en/dev/glossary/#term-project)
