Skip to content

EvgVol/read-more

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

READ MORE - service for training

Certbot READ MORE workflow Python JavaScript Django Django Rest Framework Docker Docker Compose Redis Memcached RabbitMQ PostgreSQL Daphne Celery Gunicorn Daphne Nginx Bootstrap Version HTML CSS

Description

The "READ MORE" project is a web platform developed for the purpose of educating and nurturing students in various fields of knowledge. Our mission is to provide high-quality courses that are accessible to all and create an environment where students can learn, communicate, and exchange knowledge. Our website brings together several key functionalities:

Features

Courses and Learning

  • Diverse Course Offerings
  • Interactive Learning Materials
  • Community

Blog - Articles and Discussions

  • Feedback: Readers can comment on articles and participate in discussions, creating an active community.

Bookstore - Extensive Selection

  • Online Purchase: Users can easily purchase books through our interface.

Student Chat - Online Communication

Technologies Used

  • Python 3.11
  • JavaScript
  • Django 4.2
  • Django REST Framework
  • Django Channels
  • Djang Debug Toolbar
  • PostgreSQL 13+
  • SQLite3
  • Docker
  • Docker Compose
  • Redis
  • RabbitMQ
  • Memcached
  • Celery
  • OAuth2
  • Bootstrap 5
  • HTML5
  • CSS
  • GIT
  • Nginx
  • Gunicorn
  • Daphne
  • Certbot
  • CI/CD

Installation

To install and run the project locally, follow these steps:

  1. Clone the repository using:
git clone https://github.com/evgvol/read_more.git
  1. Create a .env file in the root directory of the project.

  2. Add the following environment variables to the .env file:

SECRET_KEY='django-insecure-51ydgsn!flww^)=p+m5rkp=bpan@q*em8#u^40s^4ug94l6_j('
DEBUG=False
ALLOWED_HOSTS=127.0.0.1, localhost, web
EMAIL_HOST_USER='your-email@yandex.ru'
EMAIL_HOST_PASSWORD='your-password'
EMAIL_ADMIN='your-email@yandex.ru'
DB_ENGINE=django.db.backends.postgresql
DB_NAME=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres 
DB_HOST=db
DB_PORT=5432
REDIS_HOST='127.0.0.1'
REDIS_PORT=6379
YANDEX_KEY='yandex-key'
YANDEX_SECRET='yandex-secret'
GOOGLE_KEY='google-key'
GOOGLE_SECRET='google-secret'
VK_KEY='vk-key'
VK_SECRET='vk-secret'
SOCIAL_AUTH_GITHUB_KEY='github-key'
SOCIAL_AUTH_GITHUB_SECRET='github-secret'
  1. Navigate to the project directory using:
cd backend
  1. Install the dependencies using the following command:
pip install -r requirements.txt
  1. Start the Redis using the following command:
docker pull redis
docker run -it --rm --name redis -p 6379:6379 redis
  1. Start the Django development server using the following command:
python manage.py runserver --settings=website.settings.local

#If you need a SSL using the command below:
python manage.py runserver_plus --cert-file cert.crt
  1. Open your web browser and navigate to http://localhost:8000 to view the application.

  2. To add translations of your source code, use the following command:

python manage.py makemessages --all
  1. Edit django.po files in the locale folder of each application using a text editor. After that, run the following command to compile translations:
python manage.py compilemessages

SERVER SETUP

  1. Connect to your server via SSH, if you haven't already done so, and update the APT package index:
sudo apt update
  1. Now update the packages installed in the system and install security updates:
sudo apt upgrade -y
  1. Install the Russian localization using the built-in dpkg-reconfigure utility
sudo dpkg-reconfigure locales 
  1. Restart the server:
sudo reboot
  1. Next, install the necessary PostgreSQL packages:
sudo apt install postgresql postgresql-contrib -y
  1. You can manage the database server using standard systemd commands:
sudo systemctl stop postgresql # Stop 
sudo systemctl start postgresql # Start
sudo systemctl restart postgresql # Restart
sudo systemctl status postgresql # Find out status, current status
  1. On the command line, on behalf of the postgres user, call the psql utility, this is a client program for connecting and managing a DBMS:
sudo -u postgres psql
  1. Now, through psql, create a db_name database:
CREATE DATABASE db_name;
# Upon successful creation, CREATE DATABASE will return
  1. Create a user registration record on the database server, then inform Django about this user's data (his username and password). As a result, Django will get access to the database under this name:
# Сreate a db_user user and come up with your password, more complicated than in the example
CREATE USER db_user WITH ENCRYPTED PASSWORD 'xxxyyyzzz'; 
# give the db_user user all rights when working with the db_name database
GRANT ALL PRIVILEGES ON DATABASE db_name TO db_user;  
  1. Configure access to PostgreSQL:

Make sure that PostgreSQL allows remote connection if necessary. Edit the pg_hba.conf file, which is located in /etc/postgresql/14/main/pg_hba.conf to allow remote connections if they are required.

  1. Configure PostgreSQL settings:

Change the PostgreSQL settings in the postgresql.conf file, which is located in /etc/postgresql/version/main/postgresql.conf. Some parameters that you may need to configure include listen_addresses, max_connections, and others depending on your needs.

  1. After making changes, restart PostgreSQL:
sudo systemctl restart postgresql
  1. Install Redis:

You can install Redis on Ubuntu using the apt package manager:

sudo apt install redis-server
  1. After the installation is complete, start the Redis service and enable it to start on boot:
udo systemctl start redis-server
sudo systemctl enable redis-server
  1. Configure Redis (Optional):

By default, Redis is configured to bind to localhost. If you want to allow external connections or make other configuration changes, you can edit the Redis configuration file at /etc/redis/redis.conf.

bind 0.0.0.0
  1. Make sure that Redis is really running on the server. You can use the following command to check:
redis-cli -h 001.222.333.444 -p 6379 ping
#  If the connection is successful, PONG will return

Credits

This project was created by Evgeniy Volochek. The Bootstrap framework was used to assist with the layout and styling of the website.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Contributing

If you have any questions, suggestions, requests, or comments, please feel free to open issues or pull requests in this repository.