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:
- Diverse Course Offerings
- Interactive Learning Materials
- Community
- Feedback: Readers can comment on articles and participate in discussions, creating an active community.
- Online Purchase: Users can easily purchase books through our interface.
- 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
To install and run the project locally, follow these steps:
- Clone the repository using:
git clone https://github.com/evgvol/read_more.git
-
Create a .env file in the root directory of the project.
-
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='[email protected]'
EMAIL_HOST_PASSWORD='your-password'
EMAIL_ADMIN='[email protected]'
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'
- Navigate to the project directory using:
cd backend
- Install the dependencies using the following command:
pip install -r requirements.txt
- Start the Redis using the following command:
docker pull redis
docker run -it --rm --name redis -p 6379:6379 redis
- 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
-
Open your web browser and navigate to http://localhost:8000 to view the application.
-
To add translations of your source code, use the following command:
python manage.py makemessages --all
- 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
- Connect to your server via SSH, if you haven't already done so, and update the APT package index:
sudo apt update
- Now update the packages installed in the system and install security updates:
sudo apt upgrade -y
- Install the Russian localization using the built-in dpkg-reconfigure utility
sudo dpkg-reconfigure locales
- Restart the server:
sudo reboot
- Next, install the necessary PostgreSQL packages:
sudo apt install postgresql postgresql-contrib -y
- 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
- 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
- Now, through psql, create a db_name database:
CREATE DATABASE db_name;
# Upon successful creation, CREATE DATABASE will return
- 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;
- 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.
- 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.
- After making changes, restart PostgreSQL:
sudo systemctl restart postgresql
- Install Redis:
You can install Redis on Ubuntu using the apt package manager:
sudo apt install redis-server
- 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
- 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
- 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
This project was created by Evgeniy Volochek. The Bootstrap framework was used to assist with the layout and styling of the website.
This project is licensed under the MIT License. See the LICENSE.md file for details.
If you have any questions, suggestions, requests, or comments, please feel free to open issues or pull requests in this repository.