43. Skip to content

43. Setting up your IDE

This section outlines the process for configuring your IDE for development.

🚩 Make sure you have gone through the Cloning Section before following these notes.

43.1 VS Code Setup

Open the project in VSCode (1️⃣, 2️⃣) by navigating the the place on your file system where you checked out the code in the pre-requisites step above (3️⃣).

image.png

Accept the 'trust authors' prompt

image.png

43.1.1 Install necessary extension

Before proceeding, please ensure that the necessary extension is installed. Navigate to the Extensions panel (1), then search for and install the DevContainers extension (2).

image.png

43.1.2 Copying the .env

Copy the template.env to .env image.png Edit the .env file and change the

DJANGO_SETTINGS_MODULE=core.settings.prod
to
DJANGO_SETTINGS_MODULE=core.settings.dev

image.png

43.1.3 Override Docker Configs

We are going to copy the docker overrides template to a local file that will not be under version control.

image.png

Rename the file to docker-compose.override.yml

image.png

Initially you will not need to change anything in this file, though you may want to take a look through the various configurations provided here if you want to tweak your local setup.

Now that you have your IDE set up, we can move on to building the project.

43.2 Using pycharm

📒 ⛔️ This section needs to be reviewed and organised into our docs framework.

This section is for using pycharm.

Requirements:

  • Pycharm
  • Finished Setting up the project

43.3 Setup interpreter

  1. Go to file -> setting -> Project -> Project Interpreter -> click cog -> add
    Project Interpreter

  2. Go to ssh interpreter -> Fill the form like below
    Project Interpreter

  3. Click next and fill docker as password
    Project Interpreter

  4. Click next and change interpreter like below and click finish
    Project Interpreter

  5. After finish, it will show all package like below.
    Project Interpreter

  6. In current page, click path mappings, click + button and put local path to where the project (django-project folder) and remote path is like below. and click oK.
    Project Interpreter

Now the interpreter is done. When we restart the machine, we need to do make up to run the project.

43.4 Setup run configuration

After the interpreter is done, we need configuration to run the project in development mode.

  1. Click "Add configuration" like in the cursor in the image below. (top-right)
    Project Interpreter

  2. There will be a popup, and click +, then click django server like below
    Project Interpreter
    Project Interpreter

  3. It will show the form and fill like below.
    Project Interpreter

  4. Don't click the OK yet, but click Environment Variables and add environments like below 9by clicking + button).
    Project Interpreter

  5. After that, click OK.

  6. Now we need to run the server by clicking go button in below image.
    Project Interpreter

  7. When we click the go button, pycharm will run a process until like image below.
    Project Interpreter

  8. Now it is done. We can access the development server in http://localhost:2000/

This development mode is DEBUG mode, and also whenever we change the code, the site will also change in runtime.

For more information how to set up on pycharm, please visit Using a Docker Compose-Based Python Interpreter in PyCharm

43.5 Quick Setup Guide

⛔️📒 This content needs to be reviewed and moved to the readme.

43.5.1 Production

git clone https://github.com/unicef-drp/GeoSight
cd GeoSight/deployment
docker-compose up -d

The web will be available at http://127.0.0.1/

To stop containers:

docker-compose kill

To stop and delete containers:

docker-compose down

43.5.2 Development

git clone https://github.com/unicef-drp/GeoSight-OS
cd GeoSight-OS/deployment
cp .template.env .env
cp docker-compose.override.template.yml docker-compose.override.yml

After that, do - open new terminal - on folder root of project, do

make frontend-dev
Wait until it is done when there is sentence "webpack xxx compiled successfully in xxx ms".
After that, don't close the terminal. If it is accidentally closed, do make frontend-dev again

Next step: - Open new terminal - Do commands below

make up
docker logs -f geosight_django

wait until it says

*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x55e78f7927d0 pid: 1 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 1)
spawned uWSGI worker 1 (pid: 194, cores: 1)
spawned uWSGI worker 2 (pid: 195, cores: 1)
unable to stat() /tmp/touch-me-to-reload, events will be triggered as soon as the file is created

After that, do below commands:

ctrl + c
make dev
or on new terminal
make dev

Wait until it is done.

The web can be accessed using http://localhost:2000/

If the web is taking long time to load, restart geosight_dev container by make dev-reload.
The sequence should be make frontend-dev, after that run or restart geosight_dev.

To stop dev:

make dev-kill

To reload container:

make dev-reload