This is a Flask web application designed for generating highly customizable QR codes. Whether you need a simple QR for a URL, detailed contact information, or Wi-Fi network credentials, this tool provides an intuitive interface to create them with various aesthetic options.
The project emphasizes ease of use, allowing users to control aspects like foreground/background colors, size, error correction, and even add a custom logo to their QR codes. It supports common QR code types and includes basic history tracking (per user IP) and management features.
- Multiple QR Code Types: Generate QR codes for:
- Plain Text
- URLs
- Phone Numbers
- Email Addresses
- Wi-Fi Network Credentials (SSID, Password, Encryption)
- vCard (Contact Information) with fields for name, organization, phone, email, address, website, and optional profile photo URL and notes.
- Customization Options:
- Adjust Foreground and Background Colors.
- Control Size and Border thickness.
- Select Error Correction Level (L, M, Q, H).
- Option for Rounded Modules.
- Choose Output Format (PNG or SVG).
- Add Custom Logo to the center of the QR code (for PNG output).
- User-Friendly Interface: Simple and responsive form for quick generation.
- QR Code Preview: Instantly see your generated QR code.
- Download Options: Easily download the generated QR code.
- History Tracking: View a list of QR codes generated from your IP address.
- Database Integration: Stores QR code generation details using SQLite.
- Automatic Database Schema Updates: Handles adding new columns to the SQLite database automatically on startup if they don't exist.
Follow these steps to get a local copy of the project up and running.
- Python 3.x installed on your system.
pip
(Python package installer).
-
Clone the repository:
git clone [https://github.com/gerryaudityaa/flask-qr-generator.git](https://github.com/gerryaudityaa/flask-qr-generator.git) cd flask-qr-generator
-
Create a virtual environment (recommended):
python -m venv venv
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install the required Python packages:
pip install -r requirements.txt
If you don't have
requirements.txt
yet, create one by runningpip freeze > requirements.txt
after installing Flask, qrcode, Pillow, and Werkzeug.pip install Flask qrcode Pillow Werkzeug
Then run
pip freeze > requirements.txt
to generate the file for future use. -
Configure your application: Create a
config.py
file in the root directory if it doesn't exist.# config.py import os class Config: SECRET_KEY = os.environ.get('SECRET_KEY') or 'your_super_secret_key_here' UPLOAD_FOLDER = os.path.join(os.getcwd(), 'static', 'images', 'uploads') QR_FOLDER = os.path.join(os.getcwd(), 'static', 'qr_codes') ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'svg'} MAX_CONTENT_LENGTH = 2 * 1024 * 1024 # 2 Megabytes
Replace
'your_super_secret_key_here'
with a strong, random string for production environments. -
Run the application:
flask run
The application should now be running at
http://127.0.0.1:5000/
.
- Select QR Code Type: Choose from
Text
,URL
,Phone Number
,Email
,Wi-Fi
, orvCard
. - Enter Content: Fill in the relevant details based on the selected type. For
Wi-Fi
andvCard
, specific fields will appear. - Customize (Optional): Adjust colors, size, border, error correction, rounded modules, and output format. You can also upload a logo image to be embedded in the center of the QR code (PNG format only).
- Generate: Click the "Generate QR Code" button. The QR code preview will appear on the right.
- Download: Use the "Download" button to save your QR code image.
- History: Visit the
/history
endpoint to see all QR codes generated from your IP address and manage them.
- vCard Profile Photo: When generating a vCard, you can provide a "Profile Photo URL." This URL points to an image hosted online. Not all contact applications will automatically fetch or display this image when the vCard is imported. The size of the QR code increases with more data, so linking to an external image URL is more practical than embedding raw image data directly.
- vCard Styling: The visual style (fonts, layout, colors, etc.) of the vCard after it's scanned and imported into a contact app is determined by the receiving device's operating system and contact application, not by the QR code itself. We only provide the structured data.
Contributions are welcome! If you have suggestions for improvements, new features, or bug fixes, please open an issue or submit a pull request.
Distributed under the MIT License. See LICENSE
for more information.
Gerry Auditya - [email protected]