Installation#
This installation shows you how to setup the Admin Portal of The Green Web Foundation.
In order to setup this project, we recommend following the guides from top to bottom. Skipping some topics might result in missing crucial steps for the project to work.
Development on a remote machine using Gitpod#
Why Gitpod#
This is the main supported approach for setting up a development environment. You can use other approaches, but we may not be able to provide as much support. Gitpod will spin and configure a development environment for you, to which you can connect either from your IDE or from the browser. By choosing this approach you don’t have to manually install any dependencies.
Preparing a Gitpod workspace#
After logging into Gitpod or creating an account we recommend also installing the Gitpod browser extension. This extension integrates extra functionality in websites such as Github.
Go to our Github repository and click on the Gitpod button if you have the browser extention installed or manually create and link it in your Gitpod Workspaces. It might take a couple of minutes to prepare the environment.
After Gitpod is finished preparing the environment, it will open the workspace. Close any unnecessary terminal windows. To open a new fresh terminal window press
Ctrl + `
.
Development on a local machine using virtual environments#
In an isolated virtual environment we are able to easily manage Python dependencies within the project.
Prerequisites#
If you decide to go with this approach, you need to make sure you have the system dependencies installed. Use this command (if your OS uses apt
) or equivalent for your operating system:
sudo apt install python3 python3-dev build-essential libmariadb3 libmariadb-dev
Note In the context of development, it is recommended to manage Python versions using pyenv
instead of relying on the version shipped in the operating system.
Note Currently Python version 3.8.5 is used on production.
Setup#
Before following the following list, make sure you are in the root directory (workspace/admin-portal).
Make sure you have the right Python version installed:
python --version
Install a package named
pipenv
withpip
:python -m pip install pipenv
.Once installed, use this command to install all project packages:
pipenv install --dev
. The project packages are defined inPipfile
, and the--dev
option installs both: develop and default packages.You can activate the virtual environment created for you by
pipenv
by running the command:pipenv shell
.As a final step, make sure to copy the content of
.env.test
to.env
and add the necessary credentials.
Note that this project relies on object storage. In production this is needed to store static files, but in development it is not required.
By default pipenv
loads the content of the .env
file.
Working with email#
This project has features that send email notifications to users. To test email functionality, this project uses Mailhog. It’s enabled by default in Gitpod environments, and you can access it on port 8025.