/book-site

📚 implemeted: authors, readers, price, discounts, rating, likes

Primary LanguagePythonMIT LicenseMIT

Book site

Python djangorestframework PostgresQL

CI Updates codecov

Featuring drf and Oauth

(Books have authors and readers, price and discounts, rating and likes)

Installation

git clone https://github.com/fj-fj-fj/book-site.git
cd book-site

Set your sercrets to .envrcDirenv on GitHub

# ./envrc contains

export DEBUG=True
export DJANGO_SECRET_KEY=your_django_secret_key
export DJANGO_SETTINGS_MODULE=core.settings
export DJANGO_CONFIGURATION=Dev
export DJANGO_ALLOWED_HOSTS=*
export POSTGRES_HOST=api_db  # if Docker is used else 127.0.0.1
export DATABASE_URL=postgres://postgres:postgres@${POSTGRES_HOST}:5432/postgres
export SOCIAL_AUTH_GITHUB_KEY=your_api_key
export SOCIAL_AUTH_GITHUB_SECRET=your_api_secret

Use Docker 🐳

docker-compose build --build-arg REQUIREMENT_FILE_NAME=local.txt
docker-compose up

Or running natively ⚙️

sudo -u postgres psql
postgres=# create database myproject;
postgres=# create user djangouser with encrypted password 'djangopassword';
postgres=# alter user djangouser createdb;
postgres=# grant all privileges on database myproject to djangouser;
postgres=# \q
# a few more steps 😊

# Start postgresql
sudo service postgresql start
# Configure the Python virtual environment
python3 -m venv .venv
# Activate the venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Set the manage.py to be executable
chmod +x manage.py
# Run Django migrations
python manage.py migrate
# Run tests
./manage.py test
# Run the dev server
./manage.py runserver

You can then access the webapp via http://127.0.0.1:8000/book/

License

Available under the MIT License. Full text is in the LICENSE file