Skip to content

Sillar-codes/qrcode-generator-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“± Django QR Code Generator

A simple, beginner-friendly web application built with Django that generates QR codes from text or URLs. This project features a beautiful, responsive UI with a modern gradient design.

QR Code Generator Python License

✨ Features

  • 🎯 Simple Interface: Clean and intuitive form to generate QR codes
  • ⚑ Instant Generation: Create QR codes in seconds
  • πŸ’Ύ Download Option: Save generated QR codes as PNG files
  • πŸ“± Responsive Design: Works perfectly on desktop, tablet, and mobile devices
  • 🎨 Modern UI: Beautiful gradient design with smooth animations
  • πŸ”’ No Login Required: Start generating QR codes immediately
  • πŸ’‘ Beginner-Friendly: Easy to understand code structure for learning

πŸ› οΈ Tech Stack

  • Backend: Django 4.2.7
  • Frontend: HTML5, CSS3
  • QR Code Library: qrcode 7.4.2
  • Image Processing: Pillow 10.1.0
  • Database: SQLite3 (Django default)

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Python 3.8 or higher
  • pip (Python package installer)

πŸš€ Installation & Setup

Follow these steps to run the project on your local machine:

1. Clone the Repository

git clone <your-repository-url>
cd Django-QR-Code-Generator

2. Create a Virtual Environment

On Windows:

python -m venv venv
venv\Scripts\activate

On macOS/Linux:

python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Apply Migrations

python manage.py migrate

5. Run the Development Server

python manage.py runserver

6. Access the Application

Open your web browser and navigate to:

http://127.0.0.1:8000/

πŸ“– How to Use

  1. Enter Your Data: Type or paste any text or URL in the input field
  2. Generate: Click the "Generate QR Code" button
  3. View: See your QR code displayed on the screen
  4. Download: Click "Download QR Code" to save it as a PNG file
  5. Create Another: Click "Create Another" to generate more QR codes

πŸ“ Project Structure

Django-QR-Code-Generator/
β”‚
β”œβ”€β”€ manage.py                 # Django management script
β”œβ”€β”€ requirements.txt          # Project dependencies
β”œβ”€β”€ README.md                # Project documentation
β”œβ”€β”€ db.sqlite3               # SQLite database (created after migration)
β”‚
β”œβ”€β”€ qrcode_project/          # Main project directory
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ settings.py          # Project settings
β”‚   β”œβ”€β”€ urls.py              # Main URL configuration
β”‚   β”œβ”€β”€ asgi.py
β”‚   └── wsgi.py
β”‚
β”œβ”€β”€ generator/               # QR code generator app
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ admin.py
β”‚   β”œβ”€β”€ apps.py
β”‚   β”œβ”€β”€ models.py            # Database models (not used in this simple version)
β”‚   β”œβ”€β”€ views.py             # View functions for handling requests
β”‚   β”œβ”€β”€ urls.py              # App-specific URL patterns
β”‚   └── tests.py
β”‚
β”œβ”€β”€ templates/               # HTML templates
β”‚   β”œβ”€β”€ base.html            # Base template with common layout
β”‚   └── generator/
β”‚       β”œβ”€β”€ home.html        # Home page with form
β”‚       └── result.html      # Result page with QR code
β”‚
β”œβ”€β”€ static/                  # Static files (CSS, JS, images)
β”‚   └── css/
β”‚       └── style.css        # Main stylesheet
β”‚
└── media/                   # Generated QR codes (created automatically)
    └── qrcodes/

🎨 Customization

Changing Colors

Edit static/css/style.css to customize the color scheme:

/* Main gradient background */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Button colors */
.btn-generate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

QR Code Settings

Modify QR code properties in generator/views.py:

qr = qrcode.QRCode(
    version=1,          # Size of QR code (1-40)
    error_correction=qrcode.constants.ERROR_CORRECT_L,  # Error correction level
    box_size=10,        # Size of each box in pixels
    border=4,           # Border size in boxes
)

πŸ”§ Troubleshooting

Issue: Module not found errors

Solution: Make sure you've activated the virtual environment and installed all dependencies:

pip install -r requirements.txt

Issue: Port already in use

Solution: Run the server on a different port:

python manage.py runserver 8080

Issue: Static files not loading

Solution: Run the collectstatic command:

python manage.py collectstatic

🌟 Features Explained

Home Page

  • Clean form interface with a textarea for user input
  • Emoji icons for visual appeal
  • Info cards showing key features
  • Fully responsive design

Result Page

  • Displays the generated QR code in a card layout
  • Shows the original data entered
  • Download button to save the QR code
  • Option to create another QR code
  • Usage tips for beginners

πŸ“š Learning Resources

This project is perfect for beginners learning Django. Key concepts covered:

  • Django project structure
  • URL routing
  • Views and templates
  • Static files management
  • Media files handling
  • Form handling with POST requests
  • File generation and downloads
  • Responsive CSS design

🀝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest new features
  • Submit pull requests
  • Improve documentation

πŸ“ License

This project is open source and available under the MIT License.

πŸ‘¨β€πŸ’» Author

Created with ❀️ for learning Django

πŸ™ Acknowledgments

  • Django framework for making web development simple
  • qrcode library for easy QR code generation
  • All contributors and users of this project

πŸ“ž Support

If you have any questions or need help:


Happy Coding! πŸš€

Remember: This is a learning project. For production use, add proper error handling, validation, and security measures.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published