Skip to content

arbisoft/session-portal-backend

Repository files navigation

Arbisoft Sessions Portal

python Django PostgresSQL

Setup Guide to setup project from scratch.

Set up Environment Variables

Create .env file at the root of the project from the following and set the variables:

DB_NAME=asp
DB_USER=<your postgres user>
DB_PASSWORD=<your postgres password>
DB_HOST=<your postgres host >
DB_PORT=5432

DJANGO_PORT=<django server port>
DJANGO_SECRET_KEY=<django secret key>
DJANGO_DEBUG=<django debug flag>

Code setup

Create local.py file

On root of your project run the command

$ cp arbisoft_sessions_portal/settings/local.example.py arbisoft_sessions_portal/settings/local.py

Option 1: Setup Using Virtual Environment

Python 3.12

Install pyenv

$ brew install pyenv
$ echo 'eval "$(pyenv init -)"' >> ~/.zshrc
$ source ~/.zshrc

Install Python 3.12

$ pyenv install 3.12

PIP

Install pip3 by running:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py

PostgreSQL

Install using brew

$ brew install postgresql@16

Start service

$ brew services start postgresql@16

Install, Create and Activate Virtual Environment

Install pyenv-virtualenv:

Install pyenv-virtualenv with homebrew and add its init to your .zshrc

$ brew install pyenv-virtualenv
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc
$ source ~/.zshrc

Create a virtual environment (with Python 3.12.6) for the asp project and activate it:

$ pyenv virtualenv 3.12.6 venv-3.12.6

You can set it as default for the repo (activated each time you enter the project's directory). Execute the following from the root of the repo:

$ pyenv local venv-3.12.6

Or, alternatively, you can activate it manually and work while it is on:

$ pyenv activate venv-3.12.6

Install dependencies:

At project root run the following command to install dependencies:

$ pip install -r requirements/base.txt

Database setup

Create a new database using command

$ createdb asp

Migrate

Apply the migrations

$ python manage.py migrate

Run server

Run the server

$ python manage.py runserver

Option 2: Set Up Using Docker

Prerequisites

Before you begin, ensure that you have the following installed:

Build and Start Docker Containers

This command will rebuild and start all the services using the configuration defined in docker-compose.yaml

docker-compose up --build 

Once the containers are up, check the API connection by visiting http://localhost:${DJANGO_PORT} to ensure the Django app is running properly.

Run Linting

To run linting for the project, use the following command:

docker-compose --profile dev up lint

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •