25. 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.
25.1 VS Code setup¶
Open the project in VSCode (1️⃣, 2️⃣) by navigating the place on your file system where you checked out the code in the pre-requisites step above (3️⃣).
Accept the 'trust authors' prompt
25.1.1 Copying the .env¶
Copy the template.env
to .env
Edit the .env
file and change the
to
25.1.2 Override Docker configurations¶
We are going to copy the docker overrides template to a local file that will not be under version control.
Rename the file to docker-compose.override.yml
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.
25.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
25.3 Setup interpreter¶
-
Go to File -> Settings -> Project -> Project Interpreter. Then click on the cog -> add
-
Go to the ssh interpreter tab and fill in the form as shown below
-
Click next and fill in docker as the password
-
Click next and change the interpreter as below, then click finish.
-
After you click finish, it will show all of the packages like below.
-
In the current page, click path mappings, click the + button and put the local path to where the project (django-project folder) and the remote path are like below. and click OK.
Now the interpreter is done. When we restart the machine, we need to do make up
to run the project.
25.4 Setup run configuration¶
After the interpreter is done, we need configuration to run the project in development mode.
-
Click "Add configuration" like in the cursor in the image below. (top-right)
-
There will be a popup, and click +, then click django server like below
-
It will show the form and fill it as shown below.
-
Don't click the OK yet, but click Environment Variables and add environments as shown below (by clicking the + button).
-
After that, click OK.
-
Now we need to run the server by clicking go button in the below image.
-
When we click the go button, pycharm will run a process as shown in the image below.
-
Now it is done. We can access the development server in http://localhost:2000/
This development mode is DEBUG mode, and whenever we change the code, the site will also change in runtime.
For more information on how to set up on pycharm, please visit Using a Docker Compose-Based Python Interpreter in PyCharm
25.5 Quick setup guide¶
⛔️📒 This content needs to be reviewed and moved to the readme.
25.5.1 Production¶
git clone https://github.com/project-name/repository
cd project-name/deployment
docker-compose up -d
The web will be available at http://127.0.0.1/
To stop containers:
To stop and delete containers:
25.5.2 Development¶
git clone https://github.com/project-name/repository
cd project-name/deployment
cp .template.env .env
cp docker-compose.override.template.yml docker-compose.override.yml
After that,
- open new terminal
- on folder root of the project, do
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
Wait until it is on.
The web can be accessed using http://localhost:2000/
If the web is taking a long time to load, restart project-name_dev container by make dev-reload
.
The sequence should be make frontend-dev
, after that run or restart project-name_dev.
To stop dev:
To reload the container: