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 buildIf you prefer not to use Docker, you can manually build the app. Before installing the DatingBot project, ensure Python is installed:
$ python -VIf Python is installed, clone the DatingBot repository:
$ git clone https://github.com/DavidRomanovizc/DatingBot.gitCreate a virtual environment:
$ python -m venv venvActivate the virtual environment:
On Windows:
$ venv\Scripts\activateOn macOS and Linux:
$ source venv/bin/activate$ pip install -r requirements.txtAfter setting up the virtual environment, install Poetry with pip:
$ pip install poetryThen install Poetry dependencies:
poetry installFollow the same steps as described in the Docker section for setting up the .env file. But use localhost for DB_HOST
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)ftjRun 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- Extract texts from files (he finds it himself)
$ pybabel extract -F babel.cfg -o locales/dating.pot . - Create a folder for English translation
$ pybabel init -i locales/dating.pot -d locales -D dating -l en
- For Russian translation
$ pybabel init -i locales/dating.pot -d locales -D dating -l ru
- Translate and compile
$ pybabel compile -d locales -D dating
- 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 - Manually translate, then compile
$ pybabel compile -d locales -D dating