anarchistMegaByte / breakit-backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

breakit-backend

Steps of installation

Clone the github repository from here

git clone https://github.com/anarchistMegaByte/breakit-backend.git

Activating python3 virtual env.

pip install virtualenv
virtualenv -p python3 env-name
source env-name/bin/activate (basically path to activate script of env)

Installing required libraries.

Navigate to project folder and activate the environment before executing this command.

pip install -r requirements.txt

Installing supervisor.

This is optional only if you have to schedule tasks. (Support for ubuntu systems. Windows system needs more configurations).

sudo apt-get install supervisor

Installing postgresql and create a sample Database locally.

If on Ubuntu follow steps given in link1 and link2.

General steps are as follows for ubuntu system:

sudo apt-get install postgresql-12

Steps to create a Database:


sudo -u postgres psql
postgres=# CREATE DATABASE sampledb; 
CREATE DATABASE
postgres=# CREATE USER sampleUser WITH PASSWORD 'password'; 
CREATE ROLE
postgres=# ALTER ROLE sampleUser SET client_encoding TO 'utf8'; 
ALTER ROLE
postgres=# ALTER ROLE sampleUser SET default_transaction_isolation TO 'read committed'; 
ALTER ROLE
postgres=# ALTER ROLE sampleUser SET timezone TO 'UTC'; 
ALTER ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE sampledb TO sampleUser; 
GRANT
postgres=# \q


Postgresg USer : postgres
Database Name : sampledb
Database User : sampleUser
Database Password : password

Perform Database Migrations

python manage.py makemigratios
python manage.py migrate

Install Redis Server

sudo apt install redis-server

Run server locally.

python manage.py runserver 0.0.0.0:8000

Get your local IP address

Now you can use this endpoint for the front end applications.

About


Languages

Language:Python 100.0%