Skip to content

Latest commit

 

History

History
159 lines (119 loc) · 5.33 KB

DEVELOPMENT.md

File metadata and controls

159 lines (119 loc) · 5.33 KB

🏗️ Development Instructions

📚 Table of Contents

👷 Getting Started

🚧 With docker

First, rename the file .env.dist to .env.
Afterward, fill it with the required data.

Variable Type Importance Description
BOT_TOKEN str True Bot token
ADMINS list True list of admins id
SUPPORTS list True list of supports id
IP str True ip for other services
TIMEZONE str True your time zone for working with the scheduler
MODERATE_CHAT str True telegram chat where the event will be moderated
POSTGRES_USER str True username of the database owner
POSTGRES_PASSWORD str True password from the database
DB_HOST str True IP address of the database (Name of the service in the docker-compose.yml (User db)).
DB_PORT str True the database port. Usually the db running on port 5432
POSTGRES_DB str True database name
SECRET_KEY str True secret key for django
API_KEY str True yandex api key for yandex map
QIWI_KEY str True qiwi api key for receiving payments
PHONE_NUMBER str True your phone number (need for qiwi)
SECRET_P2 str True public p2 key which allows you to issue an invoice and open a transfer form
USE_REDIS bool False Optional parameter

Once done, run the following command:

$ docker-compose build

♿ Manually

If you prefer not to use Docker, you can manually build the app. Before installing the DatingBot project, ensure Python is installed:

$ python -V

If Python is installed, clone the DatingBot repository:

$ git clone https://github.com/DavidRomanovizc/DatingBot.git

Create a virtual environment:

$ python -m venv venv

Activate the virtual environment:

On Windows:

$ venv\Scripts\activate

On macOS and Linux:

$ source venv/bin/activate

with requirements

$ pip install -r requirements.txt

with poetry

After setting up the virtual environment, install Poetry with pip:

$ pip install poetry

Then install Poetry dependencies:

poetry install

🚀 Usage

Follow the same steps as described in the Docker section for setting up the .env file. But use localhost for DB_HOST

📗 Django

To create a SECRET_KEY, use this site - generate secret keys and paste it into the .env file

SECRET_KEY=jjv@^0qv^=aydunfjo$qpd_66j+)egm1#-c1iwt%mtjinm)ftj

Run the following commands to set up the Django application:

$ python django_app.py makemigrations
$ python django_app.py migrate
$ python django_app.py createsuperuser
$ python django_app.py makemigrations usersmanage 
$ python django_app.py migrate usersmanage
$ python django_app.py runserver

🌐 i18n

Title - dating

Launching for the first time

  1. Extract texts from files (he finds it himself)
    $ pybabel extract -F babel.cfg -o locales/dating.pot .
  2. Create a folder for English translation
    $ pybabel init -i locales/dating.pot -d locales -D dating -l en
  3. For Russian translation
    $ pybabel init -i locales/dating.pot -d locales -D dating -l ru
  4. Translate and compile
    $ pybabel compile -d locales -D dating

Updating translations

  1. Extract texts from files, add text to translated versions
    $ pybabel extract -F babel.cfg -o locales/dating.pot .
    $ pybabel update -d locales -D dating -i locales/dating.pot
  2. Manually translate, then compile
    $ pybabel compile -d locales -D dating

🧪 Tests