Website Builder Module¶
File: Lenzeye.py (website routes section)
What It Does¶
Generates a studio website from user-supplied metadata and Wasabi S3 photos. Website is accessed via a unique Lenzeye code (web_lnzcode) in the URL. Uses no frontend framework — pure server-side Jinja2 rendering.
Website Creation Flow¶
flowchart TD
A[User fills studio
details in dashboard] --> B[POST /create-website]
B --> C[Generate unique
web_lnzcode]
C --> D[Generate 64-char
access token]
D --> E[Save to user
record in DB]
E --> F[Website live at
/studio/web_lnzcode]
Key Fields (on User model)¶
| Field | Type | Purpose |
|---|---|---|
web_studioname |
String | Studio display name |
web_foundername |
String | Founder name |
web_contactnumber |
String | Contact phone |
web_wanumber |
String | WhatsApp number |
web_address |
String | Studio address |
web_instalink |
String | Instagram URL |
web_youtubelink |
String | YouTube channel URL |
web_foundedyear |
String | Founding year |
web_gst |
String | GST number (optional) |
web_lnzcode |
String(20), unique | URL code for this studio |
web_access_token |
String(64), unique | Token for data API |
web_numofprojects |
Integer | Gallery project count (default 10) |
web_perprojectfiles |
Integer | Files per project (default 10) |
websites_created_count |
Integer | How many times website was re-created |
Key Routes¶
| Route | Method | Description |
|---|---|---|
/create-website |
POST | Create/update studio website |
/edit-website |
POST | Edit studio information |
/studio/<web_lnzcode> |
GET | Public studio website (no auth) |
/studio/<web_lnzcode>/gallery |
GET | Gallery page with project photos |
/website/data/<access_token> |
GET | JSON API returning website data |
/website/qr/<web_lnzcode> |
GET | Download QR code for studio URL |
/website/qr-themed/<web_lnzcode> |
GET | Download themed/colored QR code |
QR Code Generation¶
```python import qrcode
qr = qrcode.QRCode(version=1, box_size=10, border=4) qr.add_data(f"https://lenzeye.com/studio/{web_lnzcode}") qr.make(fit=True) img = qr.make_image(fill_color="black", back_color="white") ```
- Plain QR: black on white
- Themed QR: user-selectable fill and background color (
/website/qr-themed/) - Returned as PNG download
Gallery Data Loading¶
- Gallery photos are loaded from Wasabi S3 using
list_objects_v2on the user's prefix - Photos are selected based on
web_numofprojectsandweb_perprojectfilessettings - No gallery photos are stored separately — always pulled live from S3
- Gallery is organized into "projects" (groups of photos)
Security¶
- Studio website is publicly accessible via
web_lnzcodeURL - No file download links are exposed — only presigned display URLs for gallery images
- The
web_access_token(64-char) is required for the JSON data API — prevents enumeration - Studio information (name, contact, address) is publicly visible by design
TL;DR¶
What it does: Server-side studio website generation from DB fields + S3 photos. Unique URL per studio. QR code generation (plain + themed). JSON API secured by access token.
Key techniques: Jinja2 server rendering, qrcode library, S3 list_objects_v2 for gallery, 64-char web_access_token for API security, unique web_lnzcode as URL slug.