Setup Guide to setup project from scratch.
- Covered OS:
- macOs
- Table of Contents
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>
On root of your project run the command
$ cp arbisoft_sessions_portal/settings/local.example.py arbisoft_sessions_portal/settings/local.py
$ brew install pyenv
$ echo 'eval "$(pyenv init -)"' >> ~/.zshrc
$ source ~/.zshrc
$ pyenv install 3.12
Install pip3 by running:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py
$ brew install postgresql@16
$ brew services start postgresql@16
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
At project root run the following command to install dependencies:
$ pip install -r requirements/base.txt
Create a new database using command
$ createdb asp
Apply the migrations
$ python manage.py migrate
Run the server
$ python manage.py runserver
Before you begin, ensure that you have the following installed:
- Docker: https://docs.docker.com/engine/install/ubuntu/
- docker-compose: https://docs.docker.com/compose/install/
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.
To run linting for the project, use the following command:
docker-compose --profile dev up lint