It is a typing speed trainer web application implemented via Django and vanilla JavaScript.
All environment variables that are used in development are specified in the .env.dist
file in the env
folder. Also, this file is used in the docker-compose.dev.yml
file and shell scripts.
Firstly, you must install all necessary dependencies. For this, you should create a virtual environment. For instance, you may use a virtualenv
:
$ virtualenv --python 3.10 venv
Afterwards, activate it:
$ . venv/bin/activate
The requirements
directory has two files:
dev.txt
- contains all dependencies that are used during a development processprod.txt
- contains all dependencies that are used at the production
Install all packages that are specified in the dev.txt
file. Run the following command to make it:
$ pip install -r requirements/dev.txt
The application uses Redis
and Postgres
databases. Also, JavaScript at the frontend uses API for generating random words. To simplify the setup process of all these services you already have a docker-compose.dev.yml
file that has done it for you. You can start them with all necessary environment variables via shell script start_environment.sh
that is placed in the scripts
folder. Type the following command to make it:
$ . scripts/start_environment.sh
Creating network "typing_speed_trainer_default" with the default driver
Creating typing_speed_trainer_dev_random_words_api_1 ... done
Creating typing_speed_trainer_dev_database_1 ... done
Creating typing_speed_trainer_dev_redis_1 ... done
Success
Afterwards, make migrations and run the application server:
$ cd typing_speed_trainer
$ python manage.py migrate
$ python manage.py runserver
To stop all of them you may run a shell script down_environment.sh
that is in the scripts
folder too.
$ . scripts/down_environment.sh
Stopping typing_speed_trainer_dev_database_1 ... done
Stopping typing_speed_trainer_dev_redis_1 ... done
Stopping typing_speed_trainer_dev_random_words_api_1 ... done
Removing typing_speed_trainer_dev_database_1 ... done
Removing typing_speed_trainer_dev_redis_1 ... done
Removing typing_speed_trainer_dev_random_words_api_1 ... done
Removing network typing_speed_trainer_default
Success
The application uses the Pytest package for testing. You can run all tests via the following command if you are in the typing_speed_trainer
directory:
$ pytest
Before starting the application, you must create .env
in the env
folder. You already have a .env.prod
file, which contains the template of the .env
file and several default values. You may use it in the development.
You have a docker-compose.yml
file in the root directory with all necessarily configuration. If you have created the .env
file, you will start the application if you print following command:
$ docker-compose up
The application works on 8000
port at the 127.0.0.1
ip address. Now you can go to browser and check it out.