Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.
/ book-site Public archive

๐Ÿ“š implemeted: authors, readers, price, discounts, rating, likes

License

Notifications You must be signed in to change notification settings

fj-fj-fj/book-site

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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 .envrc โ— Direnv 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