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
gitbashfor this tutorial.
mkdir pgadmin && cd pgadmin -
Clone the repository from GitHub by running the command below.
git clone https://github.com/pgadmin-org/pgadmin4.gitThis 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.jsoncopy the contents of the filedev_config.json.ininto this file. Inside thedev_config.jsonfile, edit the python path to the actual path to thepython.exein your machine.Run the command
yarn install.-
Execute the runtime by running this command.
node_modules/nw/nwjs/nwThis will start the pgAdmin.
Configuring the Python Environment for the Backend.
-
To configure the python environment, from the
pgadmindirectory, 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
pipif you are not using one already, aspgAdminrequires 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-configcan 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)