Skip to content

orb-277/Dummy_codebase

 
 

Repository files navigation

The Indegenous Library

Entire Full stack app.

Instruction for configuring the application for Development and testing:

clone the repo:

git clone https://github.com/theindegenous-tech/TheIndegenousLibrary.git

Setting up the database:

  1. Install postgreSQL

  2. Launch the postgreSQL shell using:

sudo -u postgres psql

this will login to the postgreSQL shell as user 'postgres'

  1. Create the library database using:

CREATE DATABASE library;

  1. create the admin role:

CREATE USER admin WITH PASSWORD 'admin';

  1. The following commands sets up the database :

ALTER ROLE admin SET client_encoding TO 'utf8';

ALTER ROLE admin SET default_transaction_isolation TO 'read committed';

ALTER ROLE admin SET timezone TO 'UTC';

  1. Grant permissions to admin:

GRANT ALL PRIVILEGES ON DATABASE library TO admin;

Running the backend server:

The name of the django project is backend created using:

django-admin startproject <project_name>

  1. Launch the virtual environment the below example is using pipenv however any virtual environment package can be used:

pipenv shell

It is recommended to use a virtual environment to set up the backend application in order to avoid any dependancy issue with other applications

  1. Install all required dependencies from the requirements.txt file provided using:

pip install -r requirements.txt

  1. From root, change directory to backend:

cd backend

Prepare the models for migrations using:

python manage.py makemigrations

  1. Migrate the changes to the postgreSQL database using:

python manage.py migrate

  1. Create the django superuser for manipulating the data via GUI using:

python manage.py createsuperuser

Follow the instructions and create a super user to access django-admin.

  1. run the backend server using:

python manage.py runserver

This will run the server on port 8000

django-admin can be accessed via localhost:8000/admin

Login via the superuser credentials created in step 4

Running the frontend server:

from base directory, change directory to frontend. Then:

  1. Install the required node modules using:

npm install

  1. Start the app using npm start. This will host the app on port 3000.

  2. access the website at localhost:3000

If all steps were followed and no errors were encountered, the app should be configured for development and testing.

Steps for starting the Backend server for the first time:

  1. comment out lines in backend/the_indegenous_backend/api/views : 9->17 and 65->89
  2. Follow steps 1 to 5 as usual. Reason: The code for the trie tree involves getting all the books and creating the datastructure for searching the books. This seems to run before the migrations of the models to the database thus interfering with the migration process. Upon completing the migration it should be uncommented to resume normal functionality.

About

Indegenous Stack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.3%
  • JavaScript 7.4%
  • CSS 1.6%
  • HTML 1.3%
  • C 0.3%
  • PowerShell 0.1%