How diya050/resale_x works
Project type and purpose
• This is a full-stack web application (“ResaleX”) built with Django (Python) on the back end, Bootstrap/HTML/CSS/JS on the front end, and an integrated machine-learning model (XGBoost) for resale-price prediction. It functions as a marketplace for pre-owned cars, with user authentication, listing management, search filters, and email notifications.
File structure
• Top level:
• Procfile, runtime.txt – Heroku deployment
• requirements.txt – Python dependencies
• previews/ – screenshot assets
• src/ – application source
• Inside src/:
• resale_x/ – Django project settings, ASGI/WSGI, URL routing
• main/ – “main” app (listings, filters, forms, ML)
• users/ – “users” app (registration, login, profile)
• media/ – uploaded listing images
• db.sqlite3 – development database
• manage.py – Django CLI entry point
• “main/ml/” holds serialized artifacts: best_xgb.model, scaler.pkl, mappings, etc.
README
• Confirms tech stack: Django, Bootstrap, XGBoost
• Describes key features: authentication, listings CRUD, price prediction, dynamic filters, email notifications
• Notes deployment targets (PostgreSQL in prod, SQLite for dev) and standard Django setup steps.
Main components
a. Client (Browser/Mobile)
• Renders HTML templates, CSS, JS; interacts via HTTP/AJAX
b. Web Server / Load Balancer (e.g., Heroku Dyno + Gunicorn)
• Receives HTTP requests, forwards to Django
c. Django Application
• Project layer (resale_x)
• Apps:
• Users App: authentication, profiles
• Main App: listings, search filters, CRUD, price-prediction API
• ML Module: loads XGBoost artifacts, runs inference
d. Database
• PostgreSQL (prod) / SQLite (dev) storing users, listings, likes, migrations
e. Media Storage
• Local filesystem or cloud storage (S3, etc.) for uploaded images
f. External Services
• Email SMTP service for notifications
g. Static File Server / CDN
• Serves CSS/JS/assets (Bootstrap, custom styles)
Relationships and interactions
• Client → Web Server: HTTP GET/POST for pages, AJAX calls for “Predict My Car Price”
• Web Server → Django Views:
• Users URLs → Users Views (login, register, profile)
• Main URLs → Main Views (list, detail, create, edit, AJAX-predict endpoint)
• Django Views → ML Module: load model artifacts, run prediction
• Django Views → Database: read/write models (User, Profile, Listing, Likes)
• Django Views → Email Service: send contact emails
• Django Static/Media Handling → Static File Server / Media Storage
• Web Server ↔ CDN: serve static assets efficiently
Architectural patterns and design principles
• MVC (MVT) pattern inherent to Django: Models (models.py), Views (views.py), Templates (templates/), Forms, Filters
• Separation of concerns:
• Authentication logic in users app
• Business logic + ML in main app
• Externalized ML artifacts: single responsibility for prediction
• Standard 3-tier segmentation: Presentation (browser), Application (Django), Data (DB & media)
Detail without overthinking
• Every app (users, main, resale_x), the ML artifacts directory, media folder, static assets, and deployment config (Procfile).
• How the price-prediction endpoint fits into the CRUD flow.
• Real file-tree modules: migrations, utils, forms, filters, templates, static/js/css.