We follow a systematic Git Workflow -
- Create a fork of this repo.
- Clone your fork of your repo on your pc.
- Add Upstream to your clone
- Every change that you do, it has to be on a branch. Commits on master would directly be closed.
- Make sure that before you create a new branch for new changes,syncing with upstream is neccesary.
Make sure that you install pre-commit hooks before you make any contributions so that your code is refactored according to standards.
To do that run the following inside the project repo -
pre-commit install
-
Fork the repo and clone it.
-
Go in the repo and setup virtualenvironment using
python -m virtualenv venv
-
Then activate the environment using
On Windowssource venv/Scripts/activate
On MacOS/Linuxsource venv/bin/activate
-
Change into the
./hashx
directory.All the following steps are to be executed in the hashx directory.
-
Install requirements
pip install -r requirements.txt
-
Rename
.env.debug
to.env
-
set secret key for your django project.
-
You can use [https://djecrety.ir/] to generate your secret key
-
After the above setup, run
python manage.py makemigrations
python manage.py migrate
-
Start the backend server
python manage.py runserver
Runs the backend server at default port8000
.
Open http://localhost:8000 to view it in the browser.
The page will reload if you make edits.
- At your root directory run
npm install
to install all the dependencies - Start react dev server
npm run dev
Runs the app in the development mode.
Open http://localhost:8000 to view it in the browser.
- In your .env file, Set
REACT_APP_MAPS_API = Your API key
- Refer [https://developers.google.com/maps/documentation/javascript/get-api-key] on how to generate an API key.
- If you are adding any new requirements for the project, make sure that you are adding it to
requirements.txt
- Use only
npm install package_name
to add new packages to the frontend part.
- Make sure you have docker and docker-compose installed.
- Go to the root of the project directory.
- Run the command
sudo docker-compose build
to build the containers. - Open and inspect docker-compose.yml. Change the port setting on line 34 in this format.
ports: - host_system_port:container_port
- Run the command
sudo docker-compose up -d
to run the containers in detatched mode. - 3 containers will spin up
- The Django application (hashx_application)
- The Nginx Webserver (hashx_webserver)
- The Postgres Database Container (hashx_database)
- Run the command
sudo docker exec -it <container-name> /bin/sh
to connect to a container with an interactive shell.