This is a simple web application to manage a list of merchants. It allows you to perform CRUD (Create, Read, Update, Delete) operations on merchant records.
- HTML
- CSS (Bootstrap)
- JavaScript (jQuery)
- Django (Backend)
- Django Rest Framework
- SQLite (Database)
- Docker, Docker-compose (optional)
- Python (3.10 or higher)
- Django (5.0.2)
- Django Rest Framework (3.14.0)
- psycopg2 (2.9.1 or higher)
- Dokcer with Postgres
docker-compose -f docker-compose-postgres.yml up --build
- Dokcer with SQLIite
docker-compose -f docker-compose-sqlite.yml up --build
- Open a web browser and go to http://127.0.0.1:8000/ to view the application.
-
Clone the repository:
git clone https://github.com/yourusername/merchant-list.git
-
Navigate to the project directory:
cd merchant-list
-
Create a virtual environment (optional but recommended):
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
venv\Scripts\activate
-
On macOS and Linux:
source venv/bin/activate
-
-
Install dependencies:
pip install -r requirements.txt
-
Apply migrations:
python manage.py migrate
-
Load static files:
python manage.py collectstatic
-
Run the development server:
python manage.py runserver
-
Open a web browser and go to http://127.0.0.1:8000/ to view the application.
This project uses SQLite as the default database. The SQLite database file is created automatically during the migration process.
- Switch to PostgreSQL: Consider migrating to PostgreSQL for production use.
- Load Config from .env file
- Open
merchants_list.html
in a web browser from http://127.0.0.1:8000/.- Get list merchants.
- Create, edit, or delete merchants as needed.
- Endpoint:
http://127.0.0.1:8000/merchant/api/
- Method:
GET
(List)- Response Example:
[ { "id": 5, "created_at": "2024-02-29 15:21", "updated_at": "2024-03-01 02:18", "name": "Trần Thảo Nguyên", "description": "tran thao nguyen", "description_html": "haha", "email": "[email protected]", "phone_number": "+14324242424" }, { "id": 7, "created_at": "2024-02-29 17:21", "updated_at": "2024-02-29 17:21", "name": "Trần Thảo Nguyên", "description": "tran thao nguyen", "description_html": "haha", "email": "[email protected]", "phone_number": "+14324242427" }, { "id": 8, "created_at": "2024-03-01 02:19", "updated_at": "2024-03-01 02:20", "name": "Trần Thảo Nguyên", "description": "", "description_html": "", "email": "[email protected]", "phone_number": "+84234567890" } ]
POST
(Create)- Body:
{ "name": "new name", "description":"new description", "description_html":"new description_html", "email":"new email", "phone_number":"new phone_number", }
- Endpoint:
http://127.0.0.1:8000/merchant/api/<int:pk>/
- Method:
GET
(Retrieve)- Response Example:
{ "id": 5, "created_at": "2024-02-29 15:21", "updated_at": "2024-03-01 02:18", "name": "Trần Thảo Nguyên", "description": "tran thao nguyen", "description_html": "haha", "email": "[email protected]", "phone_number": "+14324242424" }
PATCH
(Update)- Body:
{ "name": "new name", "description":"new description", "description_html":"new description_html", "email":"new email", "phone_number":"new phone_number", }
- Body:
DELETE
(Destroy)
- Endpoint:
/
- Method:
GET
Contributions are welcome! If you find any issues or have improvements, feel free to create a pull request.
This project is licensed under the MIT License.