PyShop is a foundational e-commerce web application built with Django, designed to demonstrate core web development concepts, including database management, user interface rendering, and admin functionality. This project serves as a practical learning experience in creating a basic online shop where products can be listed, viewed, and managed.
This project addresses the fundamental requirement of displaying products online. It provides a simple, yet effective, platform for:
- Showcasing a catalog of products.
- Providing detailed information for each product.
- Allowing administrative control over product inventory.
- Product Catalog: Browse a list of available products.
- Product Details: View individual product pages with descriptions, prices, and images.
- Admin Panel: Utilize Django's powerful built-in admin interface to easily add, update, and delete products.
- Basic UI: Simple and clean user interface for navigation.
- Backend:
- Frontend:
- HTML5, CSS3 - For structuring and styling web pages.
- Bootstrap - Front-end framework for responsive and modern design.
Follow these steps to get PyShop up and running on your local machine.
-
Clone the repository:
git clone [https://github.com/meez-111/pyshop-django-shop.git](https://github.com/meez-111/pyshop-django-shop.git) cd pyshop-django-shop
-
Create and activate a virtual environment: It's highly recommended to use a virtual environment to manage project dependencies.
python -m venv venv # On Windows: .\venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install dependencies:
- Make sure you have your
requirements.txt
file in the project root.
pip install -r requirements.txt
- Make sure you have your
-
Apply database migrations:
python manage.py makemigrations products python manage.py migrate
-
Create a superuser (for admin access): You'll need an admin account to manage products through the Django admin panel.
python manage.py createsuperuser
Follow the prompts to create a username, email, and password.
-
Run the development server:
python manage.py runserver
The application will be accessible at
http://127.0.0.1:8000/
.
-
Browse Products:
- Open your web browser and go to
http://127.0.0.1:8000/products
.
- Open your web browser and go to
-
Manage Products via Admin Panel:
- Go to
http://127.0.0.1:8000/admin
. - Log in using the superuser credentials you created.
- From the admin dashboard, you can add new products, edit existing ones, and manage categories. Remember to upload images for your products to
media/products/
.
- Go to
.gitignore
: Ensure your.gitignore
file correctly excludes sensitive data and unnecessary files likedb.sqlite3
(your local development database) and themedia/
folder (for user-uploaded files). These should never be committed to version control, especially in public repositories. If these were committed previously, usegit rm --cached
to stop tracking them.requirements.txt
: Always maintain an up-to-daterequirements.txt
file (by runningpip freeze > requirements.txt
after installing dependencies) to ensure anyone can easily install all necessary libraries for your project.SECRET_KEY
: For production environments, your DjangoSECRET_KEY
should be stored securely as an environment variable, not directly insettings.py
.- Static & Media Files: In a production deployment, static and media files are served differently (e.g., via a web server like Nginx or a cloud storage solution).
- Shopping Cart & Checkout: Implement functionality for users to add items to a cart, proceed to checkout, and place orders.
- User Authentication: Allow users to register, log in, and manage their profiles.
- Search Functionality: Add a search bar to filter products by name or description.
- Payment Gateway Integration: Integrate with a mock or real payment gateway (e.g., Stripe, PayPal).
- Product Reviews: Enable users to leave reviews for products.
- Deployment: Deploy the application to a cloud platform (e.g., Heroku, Render, AWS, DigitalOcean) to make it publicly accessible.
Feel free to fork this repository, make improvements, and submit pull requests. Any contributions are welcome!
LinkeIn: My LinkedIn
Email: My Email