Introduction.
pgAdmin is a management tool for PostgreSQL and EDB Postgres advanced server, in this blog post, You will install it from source code in your Windows machine. According to the official GitHub repo,
pgAdmin 4 is written as a web application in Python, using jQuery and Bootstrap for the client side processing and UI. On the server side, Flask is being utilised.
Pre-requisites.
You need to install the tools below.
- Python.
- node.js.
- yarn through this tutorial.
Installation Guide.
-
Create a directory in any terminal of choice, I will be using
gitbash
for this tutorial.
mkdir pgadmin && cd pgadmin
-
Clone the repository from GitHub by running the command below.
git clone https://github.com/pgadmin-org/pgadmin4.git
This will successfully install it.
Building the Runtime for the frontend.
To build the runtime for the frontend, enter into the directory /pgadmin4/runtime, create a new file called
dev_config.json
copy the contents of the filedev_config.json.in
into this file. Inside thedev_config.json
file, edit the python path to the actual path to thepython.exe
in your machine.Run the command
yarn install
.-
Execute the runtime by running this command.
node_modules/nw/nwjs/nw
This will start the pgAdmin.
Configuring the Python Environment for the Backend.
-
To configure the python environment, from the
pgadmin
directory, create a virtual environment and activate this environment by running this command.
cd .. python -m virtualenv penv # creates a virtual environment source penv/Scripts/activate #activates the virtual environment
-
Upgrade to the latest version of
pip
if you are not using one already, aspgAdmin
requires the latest version via this command below.
pip install --upgrade pip
-
Add the part to your Postgres bin directory to your environment variables by running this command, this is necessary so
pg-config
can be found for buildingpsycopg3
.
export PATH="$PATH:/c/Program Files/PostgreSQL/15/bin"
This path, is the path to the PostgreSQL 15 I installed via the Windows installer. You can replace 15 with any version that you have.
-
Install the dependencies by running this command.
pip install -r requirements.txt
-
Start the server by running the command below.
python pgAdmin.py
Finally, this
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
will be seen on the terminal, which shows the server has started Happy coding.
References
https://github.com/pgadmin-org/pgadmin4
Please do give me a like and a follow if you enjoyed this blogpost.
Top comments (0)