Skip to content

erfaw/drf-ecommerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

337 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eCommerce RESTful API 🛒🔗

An e-commerce API built with Django REST Framework to learn DRF through the Udemy course Udemy – Django DRF Project eCommerce 2023 – Very Academy (Alexander, AKA Zander)

| Overview | How to Run | ER-Diagram | What I Learned |








Overview

This is a Django REST Framework (DRF) application designed for e-commerce. Product and category information is managed through the Django admin interface. The application exposes RESTful API endpoints to serve data to the front-end.

ER-Diagram

Key Technologies Used:

Backend:

Python, Django, Django REST Framework (DRF)

Database & Structure:

django-mptt for hierarchical data (e.g., product categories)

API Documentation:

drf-spectacular for generating OpenAPI 3 schemas

Testing:

pytest and pytest-factoryboy for robust testing, with coverage for code coverage analysis.

This setup allows for efficient management of e-commerce data and seamless integration with front-end applications.

🚀 How to Run

  1. Ensure you have Python installed.

  2. Clone the repository:

    git clone https://github.com/erfaw/drf-ecommerce
    
  3. Make Virtual Environment:

    python -m venv .venv
    

    then on Git Bash:

    source ./.venv/Scripts/activate
    
  4. Install dependencies:

    pip install requirements.txt
    
  5. Make super-user:

    python manage.py createsuperuser
    
  6. Run local (DEBUG = True):

    python manage.py runserver
    

💡 What I Learned

  • Data Serialization: Gained practical experience in creating and utilizing Serializers to convert complex data types, like Django model instances, into native Python datatypes that can then be easily rendered into JSON, XML or other content types.

  • API Development with ViewSets: Mastered the use of ViewSets to efficiently group related API views (e.g., list, retrieve, create, update, delete) and reduce boilerplate code, making API development more streamlined.

  • Handling Hierarchical Data: Learned to effectively manage and display hierarchical data structures using django-mptt. This included understanding how to store and query related data efficiently, leveraging self.FK relationships within serializers.

  • Incremental Refactoring: Applied the principles of incremental refactoring to maintain code quality and flexibility throughout the development process, making necessary changes without disrupting core functionality.

  • API Documentation with drf-spectacular: Implemented and configured drf-spectacular to automatically generate interactive API documentation, using swagger-ui for a user-friendly interface to explore and test API endpoints.

  • Deepened Understanding of MVT (Model-View-Template) Pattern: Reinforced a strong understanding of the Model-View-Template (a variation of MVC) design pattern, which is fundamental to Django development.

  • Environment-Specific Settings: Learned the best practice of separating settings.py for different environments (local development vs. production deployment), enhancing security and manageability.

  • Admin Area Customization: Worked with Django Admin inlines to create more intuitive and efficient data management interfaces.

Releases

No releases published

Packages

 
 
 

Contributors

Languages