Giter Site home page Giter Site logo

borisplaton / typing_speed_trainer Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 312 KB

The typing speed trainer via Django & JS

Python 55.00% HTML 20.88% SCSS 4.34% JavaScript 17.38% CSS 1.23% Dockerfile 0.21% Shell 0.96%
django docker nginx javascript

typing_speed_trainer's Introduction

Typing speed trainer

It is a typing speed trainer web application implemented via Django and vanilla JavaScript.

Main page

User page

Setup

Development

.env.dist

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.

Virtual environment

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 process
  • prod.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

Application server

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

Tests

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

Production

.env

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.

Start application

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.

typing_speed_trainer's People

Contributors

borisplaton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.