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.
- π― 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
- 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)
Before you begin, ensure you have the following installed:
- Python 3.8 or higher
- pip (Python package installer)
Follow these steps to run the project on your local machine:
git clone <your-repository-url>
cd Django-QR-Code-GeneratorOn Windows:
python -m venv venv
venv\Scripts\activateOn macOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython manage.py migratepython manage.py runserverOpen your web browser and navigate to:
http://127.0.0.1:8000/
- Enter Your Data: Type or paste any text or URL in the input field
- Generate: Click the "Generate QR Code" button
- View: See your QR code displayed on the screen
- Download: Click "Download QR Code" to save it as a PNG file
- Create Another: Click "Create Another" to generate more QR codes
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/
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%);
}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
)Solution: Make sure you've activated the virtual environment and installed all dependencies:
pip install -r requirements.txtSolution: Run the server on a different port:
python manage.py runserver 8080Solution: Run the collectstatic command:
python manage.py collectstatic- Clean form interface with a textarea for user input
- Emoji icons for visual appeal
- Info cards showing key features
- Fully responsive design
- 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
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
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
This project is open source and available under the MIT License.
Created with β€οΈ for learning Django
- Django framework for making web development simple
- qrcode library for easy QR code generation
- All contributors and users of this project
If you have any questions or need help:
- Open an issue on GitHub
- Check the Django documentation: https://docs.djangoproject.com/
Happy Coding! π
Remember: This is a learning project. For production use, add proper error handling, validation, and security measures.