This project demonstrates CRUD operations using a Django backend with a PostgreSQL database and an Angular frontend.
- Python 3.x
- Node.js and npm
- Angular CLI
- PostgreSQL
-
Install Python dependencies:
pip install -r requirements.txt
-
Set up PostgreSQL:
sudo apt install postgresql postgresql-contrib psql --version
-
Start PostgreSQL service:
sudo service postgresql start sudo service postgresql status sudo service postgresql restart
-
Access PostgreSQL as the
postgres
user:sudo -u postgres psql
Inside the PostgreSQL shell, you may need to create a new database and user. Here's an example:
CREATE DATABASE your_database_name; CREATE USER your_username WITH PASSWORD 'your_password'; ALTER ROLE your_username SET client_encoding TO 'utf8'; ALTER ROLE your_username SET default_transaction_isolation TO 'read committed'; ALTER ROLE your_username SET timezone TO 'UTC'; GRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_username;
-
Apply database migrations:
cd backend/ python3 manage.py makemigrations python3 manage.py migrate
-
Run the Django development server:
python3 manage.py runserver
-
Navigate to the frontend directory:
cd frontend/
-
Install Node.js dependencies:
npm install
-
Start the Angular development server:
ng serve
Once both the backend and frontend servers are running, you can access the application in your web browser at http://localhost:4200
.
- View Users: Displays a list of all users.
- Add User: Provides a form to add a new user.
- Edit User: Allows editing of user details.
- Delete User: Removes a user from the database.
- Send Email: (Optional) Sends an email to a user.
- Ensure PostgreSQL is running before starting the backend server.
- The frontend communicates with the backend through API endpoints defined in Django.