Local Development Environment

The steps outlined here are to setup this project in local environment so that you can edit the project and test in your local.
If you are want to have a demo or deploy this project. Please head over to Quick Install with Docker.

Warning

This setup is not intended for production environments and do not follow these steps in UAT, DEV, PROD or any other non local environments. The local/settings.py file contains a secret_key which will be a security concern.

Contents:

Prerequsites

The following prerequisites are required to run this project on your local machine.

Install python 3.7+

Run the following command to check the installed python version
python3 --version
If you have not installed Python 3.7+ on your local machine, head over to https://www.python.org/downloads/ and download latest version of Python.

Install Git

Run the following command to check the installed git version.
git --version
If you have not installed Git on your local machine, head over to https://git-scm.com/downloads and download the latest version of Git.

Install pip

Run the following command to check the installed pip version.
pip3 --version
If you have not installed Pip on your local machine, head over to https://pip.pypa.io/en/stable/installation/ and download the latest version of pip.

Install npm

Run the following command to check the installed npm version.
npm --version
If you have not installed npm on your local machine, head over to https://nodejs.org/en/download/ and download the latest version of npm and Node.js.

Setting up the project

  1. Head over to https://github.com/nearbeach/NearBeach and fork the repository to your own github account. You can skip this step if dont want to fork.
  2. Open a terminal, navigate to a folder where you want to setup this project

cd /path/to/your/project/folder
  1. Download the project from the forked repository. Copy the link from the forked repository and run the following command in the terminal.

git clone <<Forked repo URL here>>
cd ./NearBeach

If you have not forked the repository, you can clone the main repository using the following command

git clone https://github.com/nearbeach/NearBeach.git
cd ./NearBeach
  1. Download and install virtualenv

sudo pip3 install virtualenv
  1. Create your own virtual environment for python

Note

you can use any name for the virtual environment, but it is recommended to use β€œvenv” as it is already added to the .gitignore file

virtualenv venv

This will create a directory called β€œvenv” in your current directory, this will store the required python libraries for the project

  1. Activate the virtual environment

source ./venv/bin/activate

You terminal prompt will change to indicate that it is working in the virtual environment now. It should look like the following:

(venv)user@computer NearBeach$:
  1. Install the python libraries

This will install all the required python libraries for the project

pip install -r requirements-dev.txt
  1. Create the database

python3 manage.py migrate
  1. Create a superuser for the application

Execute the following command and fill the user details when prompted.
This user will act as super user for the NearBeach application. Use this user to login to the website once the Django app runs.
python3 manage.py createsuperuser
  1. Run the Django webserver

python3 manage.py runserver

Alternatively, you can run the server on a different port using the following command

python3 manage.py runserver <<Port number>>

Attention

If you see an error message like β€œDisallowedHost at /”, you need to add 127.0.0.1 to the allowed hosts in the local/settings.py file. Open local/settings.py file and add 127.0.0.1 to the ALLOWED_HOSTS list

ALLOWED_HOSTS = ['127.0.0.1']

If all the above steps are followed correctly you should see the following output:

Performing system checks...

System check identified no issues (0 silenced).
October 27, 2024 - 12:00:00
Django version 3.2.8, using settings 'NearBeach.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Note

Now that the server is running, you can access the NearBeach login page by visiting http://127.0.0.1:8000/login
You can also access the Django admin page by visiting http://127.0.0.1:8000/admin

NPM/JavaScript

  1. To install all NPM packages, please run the following code

npm install
  1. Once npm has finished installing, compile the code using the following command

npm run prod
  1. Alternatively, you can run a watch

npm run watch

Whats next

Now the road is clear for you to start contributing.

Head over to local/NearBeach folder. This is where all the python code is stored.

Warning

DO NOT modify local/settings.py!
Before commiting the code please revert back the changes that are made to local/settings.py file.

See also

Hop on to our discord server - https://discord.gg/64uhRztS6n