This project is a practical implementation focused on Ipswich Retail, aiming to transition from a monolithic system architecture to a more scalable and efficient Django MVT (Model-View-Template) framework. The goal is to address the limitations of the current system and enhance flexibility, maintainability, and performance by adopting a more modular approach.
The application includes key e-commerce functionalities such as user authentication, product browsing, cart management, and order processing, with a focus on seamless user experience and modularity.
- Replace the monolithic architecture with a modular Django MVT framework.
- Enhance deployment workflows using Render’s automated services and built-in monitoring tools.
- Improve scalability and application performance while minimizing downtime.
- Implement CI/CD pipelines for continuous integration and delivery.
- Use SQLite for a lightweight and easy-to-manage database.
scheema_retail/
│
├── scheema_retail/ # Django project folder (core functionality)
│ ├── __init__.py
│ ├── settings.py # Django settings file
│ ├── urls.py # URL routing for the project
│ ├── wsgi.py # WSGI configuration for deployment
│ ├── asgi.py # ASGI configuration for asynchronous servers
│ ├── manage.py # Django manage.py script to run commands
│ ├── templates/ # Django templates for HTML rendering
│ │ ├── base.html # Base template for inheritance
│ │ ├── home.html # Home page template
│ │ └── product_detail.html # Product detail page template
│ ├── static/ # Static assets (CSS, JS, images)
│ │ ├── css/
│ │ │ └── styles.css # Compiled CSS files (Tailwind or custom)
│ │ ├── js/
│ │ │ └── app.js # Custom JS (if needed)
│ │ └── images/ # Static images
│ └── scheema_retail_store/ # App for product and cart management
│ ├── __init__.py
│ ├── models.py # Django models for products, categories, etc.
│ ├── views.py # Views for handling product display, cart, etc.
│ ├── urls.py # URLs related to the products and cart
│ ├── forms.py # Forms for handling user input (e.g., search, cart)
│ ├── admin.py # Django admin configuration for product management
│ └── migrations/ # Database migration files
│
├── scheema_retail_frontend/ # Frontend related files (Tailwind, JS, etc.)
│ ├── templates/ # Frontend templates
│ ├── stores/ # Frontend templates for core functionality
│ │ │ ├── base.html # Base template for inheritance (now in frontend)
│ │ │ ├── home.html # Home page template
│ │ │ └── product_detail.html # Product detail page template
│ ├── tailwind.config.js # Tailwind configuration file
│ └── package.json # NPM dependencies for frontend
│
├── docker-compose.yml # Docker Compose file for containerized deployment
├── Dockerfile # Dockerfile for creating the app container
├── requirements.txt # Python dependencies for the project
├── pytest.ini # Configuration for pytest testing framework
├── .gitignore # Git ignore file to exclude unnecessary files
├── .dockerignore # Docker ignore file for unnecessary files during build
└── README.md # Project README
-
scheema_retail/
: This is the main Django project folder that contains:settings.py
: Configuration settings for the Django project.urls.py
: URL routing for the entire project.templates/
: HTML templates rendered by Django views.static/
: Static assets like CSS (Tailwind), JavaScript, and images.scheema_retail_store/
: The main app for handling product management, cart functionality, and order processing.
-
scheema_retail_frontend/
: Contains frontend-related configurations and files.tailwind.config.js
: Tailwind CSS configuration file to manage styling.package.json
: For managing JavaScript dependencies if required (like custom scripts).
-
docker-compose.yml
andDockerfile
: Configuration files to containerize the application and manage deployments. -
requirements.txt
: Python package dependencies required for the project. -
pytest.ini
: Configuration file for setting up and running tests with pytest. -
README.md
: Documentation file that describes the project, setup, and usage instructions.
- CustomLoginView(): Extends Django's default login view to include cart migration for authenticated users.
- register(): Handles user registration.
- update_profile(): Allows users to update their profile information.
- home(): Displays all available products.
- product_detail(): Shows detailed information about a specific product.
- category_products(): Lists products within a specific category.
- add_to_cart(): Adds products to the cart (supports both authenticated and guest users).
- remove_from_cart(): Removes or reduces items in the cart.
- view_cart(): Displays the current cart contents and dynamically calculates the total cost.
- place_order(): Processes orders based on cart items.
- dashboard(): Provides users with a view of their order history.
- Session-based Cart: Allows guest users to add products to a cart without logging in.
- Cart Migration: Transfers cart items seamlessly upon user login.
- Profile Management: Users can create and manage their profiles.
- Product Search: Includes functionality to search for products efficiently.
- Dynamic Cart Totals: Automatically updates cart totals based on items added or removed.
- Tailwind CSS: Modern and responsive design.
- Django Templates: For rendering dynamic content.
- Django MVT Framework: Modular architecture for improved scalability.
- SQLite Database: Lightweight and easy to manage for the PoC.
- Continuous Integration: Automated testing and code integration with GitHub Actions.
- Continuous Deployment: Seamless updates via Render.
- Monitoring and Logging: Leverages Render’s built-in tools for real-time insights.
- Python 3.8+
- Node.js (for Tailwind CSS)
- Docker (optional for local containerized development)
-
Clone the Repository:
git clone https://github.com/aliabbascheema/scheema_retail.git cd scheema_retail
-
Backend Setup:
- Install dependencies:
pip install -r requirements.txt
- Apply migrations:
python3 manage.py makemigrations python3 manage.py makemigrations scheema_retail_store python3 manage.py migrate
- Run the server:
python3 manage.py runserver
- Install dependencies:
-
Frontend Setup:
- Install Tailwind dependencies:
python3 manage.py tailwind install
- Start Tailwind CSS:
python3 manage.py tailwind start
- Install Tailwind dependencies:
-
Deploy to Render:
- Push the project to a GitHub repository.
- Connect the repository to Render for automated deployment.
- Configure environment variables and deploy services.
- Access the application on Render’s hosted URL.
- Admin dashboard available at
/admin
for managing products and orders.
- Enhanced Orchestration:
- Introduce Kubernetes for managing large-scale deployments and auto-scaling.
- PWA Features:
- Enable offline functionality and app-like experiences for users.
- AI-Driven Recommendations:
- Leverage machine learning for personalized user experiences.
- Global Adaptation:
- Support multiple languages, currencies, and regional tax compliance.
- Security Enhancements:
- Automate vulnerability scans and adopt robust security protocols.
This project demonstrates how transitioning to a Django MVT framework and adopting DevOps practices can address challenges posed by legacy systems. By using Render’s deployment and monitoring tools, alongside a modular architecture, Ipswich Retail achieves enhanced flexibility, maintainability, and performance. While SQLite meets current requirements, scaling may necessitate transitioning to PostgreSQL or MySQL in the future.
This project is licensed under the MIT License. See the LICENSE
file for more details.