This project is a 3-tier web application built using Python for the backend, with PostgreSQL as the database. The application consists of a presentation layer, a business logic layer, and a data access layer.
Before setting up the project, ensure you have the following installed on your machine:
- Ubuntu (or another compatible Linux distribution)
- Python 3.12 or higher
- PostgreSQL
-
Install the Python 3.12 virtual environment package:
sudo apt install python3.12-venv -y
-
Create a virtual environment:
python3 -m venv myenv
-
Activate the virtual environment:
source myenv/bin/activate
-
Install required Python libraries from
requirements.txt
:First, ensure
pip
is installed:sudo apt install python3-pip -y
Then, install the required libraries:
pip3 install -r requirements.txt
To install and set up PostgreSQL, follow these steps:
-
Install PostgreSQL and additional tools:
sudo apt-get install postgresql postgresql-contrib
-
Start the PostgreSQL service:
sudo systemctl start postgresql
-
Enable PostgreSQL to start on boot:
sudo systemctl enable postgresql
-
Switch to the PostgreSQL user:
sudo -i -u postgres
-
Create a new PostgreSQL user:
CREATE USER root WITH PASSWORD 'root';
-
Create a new PostgreSQL database:
CREATE DATABASE my_database;
-
Grant all privileges on the database to the new user:
GRANT ALL PRIVILEGES ON DATABASE my_database TO root;
-
Connect to the new database:
\c my_database
-
Grant all privileges on the public schema to the user:
GRANT ALL PRIVILEGES ON SCHEMA public TO root;
-
Grant create privileges on the database to the user:
GRANT CREATE ON DATABASE my_database TO root;
Once the environment and database are set up, you can run the application with the following steps:
-
Ensure your virtual environment is activated:
source myenv/bin/activate
-
Run the application:
python run.py
The application will start, and you can access it via the specified host and port in your configuration.
This project is licensed under the MIT License - see the LICENSE file for details.