This is a simple phonebook application built using the Django web framework. The app allows users to add contact names and associate them with multiple phone numbers. Users can also view a list of all contacts and view the details of individual contacts.
To run this application, you will need the following software installed on your system:
- Python 3.9 or later
- pip package manager
- Docker (optional, if you want to run the app in a container)
-
Clone this repository to your local machine:
git clone https://github.com/houssam966/tam_phonebook.git
-
Change into the project directory:
cd tam_phonebook
-
(Optional) If you're using Docker, build and run the Docker container:
docker-compose up --build
This will build the Docker image and start the container. You can access the Django phonebook app at http://localhost:8000/phonebook/
. Any changes you make to the code will be automatically reflected in the running container.
-
(Alternative) If you're not using Docker, install the dependencies:
pip install -r requirements.txt
-
Apply the database migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
Run the Django phonebook app and then:
-
Open your web browser and go to
http://localhost:8000/phonebook/
. -
To add a new contact, click the "Add Contact" button or navigate to
http://localhost:8000/phonebook/add_contact/
and enter the contact name and phone numbers. -
To view a list of all contacts, click the "Contacts" button or navigate to
http://localhost:8000/phonebook/
. -
To view the details of an individual contact, click the contact's name in the contact list.
Table: "phonebook_contact"
----------
| id | name |
----------
Table: "phonebook_phonenumber"
---------------------
| id, number, contact_id |
---------------------
contact_id is a foreign key that references the id of a phonebook_contact. This schema allows multiple phone numbers for each contact.