Reorganize documentation, add demo URL

This commit is contained in:
coox 2020-05-10 17:14:24 +02:00
parent 2f0f67d15a
commit 79c5a14c70
2 changed files with 62 additions and 17 deletions

View File

@ -1,12 +1,4 @@
## Development Environment FAQ
### How to run tests?
From the project root directory, execute the following command:
```sh
make test
```
## Developer FAQ
### How to maintain the Requirements File (`requirements.txt`)?
@ -28,21 +20,35 @@ make generate_requirements_file
make install_dev
```
### How to run a code formatter?
### How to run tests?
Run [Black](https://black.readthedocs.io/):
From the project root directory, execute the following command:
```sh
# Dry-run, showing what should be rewritten:
make check_code_format
make test
```
# Run code format:
### How to run a code formatter?
This project requires using [Black](https://black.readthedocs.io/) as a code formatter.
From the project root directory, execute the following command to show what must be reformatted:
```sh
make check_code_format
```
Execute the following command to format the code:
```sh
make format_code
```
### How to run a linter?
Run [Flake8](https://flake8.pycqa.org/):
This project requires using [Flake8](https://flake8.pycqa.org/) as a code linter.
From the project root directory, execute the following command to show what must be corrected:
```sh
make lint

View File

@ -2,10 +2,49 @@
A micro project proposed as a screening task for the [Senior Django Developer](https://ungleich.ch/en-us/cms/jobs-ungleich/) position at [ungleich](https://ungleich.ch/).
## Installation
## Overview
On a system, or in a virtual environment where [Python](https://www.python.org/) version 3.6 or above, and [`pip`](https://pip.pypa.io/) and [`setuptools`](https://pypi.org/project/setuptools/) are available, run the following command to install required modules:
Per requirements, the project behaves differently depending on the version of the [Internet Protocol](https://en.wikipedia.org/wiki/Internet_Protocol) used to navigate it:
- Via IPv4, it shows a static page saying "Sorry, only reachable by IPv6"
- Via IPv6, it shows a friendly cat picture
To determine which version is used, we examine the visitors IP address. This is done in a [middleware](require_ipv6) that responds with an error page to non-IPv6 requests.
If the request goes through, a simple [application](friendly_cat) can be accesses, with a single index view showing a friendly picture of a cat.
## Demo
A live demo of the project is available at: [https://ungleich-screening-task.coox.fr/](https://ungleich-screening-task.coox.fr/).
It is served by [Gunicorn](https://gunicorn.org/) through [Caddy](https://caddyserver.com/).
## Usage
To install and run the project on your own computer, you must ensure that the following prerequisites are fulfilled:
- your operating system [supports IPv6](https://en.wikipedia.org/wiki/Comparison_of_IPv6_support_in_operating_systems)
- you can run [Python](https://www.python.org/) version 3.6 or above (it is recommended to use a [virtual environment](https://docs.python.org/3/tutorial/venv.html)), with:
- [`pip`](https://pip.pypa.io/)
- [`setuptools`](https://pypi.org/project/setuptools/)
- you can run the [`make`](https://www.gnu.org/software/make/) command
Proceed to [cloning](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository) this repository, and navigate to its directory.
Then, execute the following command to install the projects required modules:
```sh
make install
```
Then, execute the following command to run the project using Djangos built-in web server:
```sh
make run
```
You can then navigate the project at [http://localhost:8000/](http://localhost:8000/).
## Hacking
See [CONTRIBUTING](CONTRIBUTING.md) for developer documentation.