E-Commerce Project: Interview Questions & Answers
1. Can you explain your e-commerce project architecture?
My project follows MVC pattern (Model-View-Controller). Model handles data using Django ORM,
View contains logic, and Template handles frontend (HTML/CSS/Bootstrap).
2. How did you design your database schema for products, users, orders, and cart?
I created models for Product, User, Order, and Cart. Cart has ForeignKey to both User and Product.
3. Did you use Django's default User model or create a custom one? Why?
I used Django's default User model as it includes useful fields. I would extend it if I needed extra
fields.
4. How does user authentication and authorization work in your application?
Used Django's authentication system with LoginView, LogoutView, and @login_required for
protected views.
5. How did you implement the cart system?
Cart model has User, Product, and quantity fields. Quantity increases if the same product is added
again.
6. What happens when a guest user adds items?
Used Django sessions to store cart data. On login, session cart is merged with the user cart.
7. How do you handle quantity increases?
If product already in cart, I increment quantity and save it. Otherwise, create a new entry.
8. How is the checkout process handled in your app?
Cart is converted into an Order, products become OrderItems, and cart is cleared after checkout.
9. Did you integrate payment gateways like Razorpay, PayPal, etc.?
No real payment. I used a dummy confirmation page after checkout.
10. How do you manage product listing and filtering?
Used Django ORM to filter by category, price, or search keyword using .filter() queries.
11. Did you use Django forms or DRF for APIs?
I used Django Forms for all interactions. DRF was not used.
12. How do you handle session management for carts and login?
Used Django sessions to manage guest carts and transferred data after login.
13. What are the models you created and their relationships?
User (default), Product, Cart, Order, and OrderItem. Used ForeignKey relations for OneToMany.
14. How did you manage media files (images of products)?
Used ImageField in Product model, and configured MEDIA_URL and MEDIA_ROOT in settings.py.
15. Did you implement order confirmation emails?
Yes, using Django's send_mail function and SMTP backend.
16. What is the most challenging part of the project, and how did you solve it?
Handling guest carts and merging them with user carts after login using sessions.
17. How do you ensure security in your application?
Used {% csrf_token %} in forms, Django escapes HTML for XSS, and restricted views using
@login_required.
18. Did you deploy your project? If yes, where and how?
Yes, on PythonAnywhere using Git, setting up environment variables, static/media files, and allowed
hosts.