惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
The Hacker News
The Hacker News
L
LINUX DO - 最新话题
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
S
Secure Thoughts
S
Schneier on Security
MyScale Blog
MyScale Blog
月光博客
月光博客
U
Unit 42
www.infosecurity-magazine.com
www.infosecurity-magazine.com
AI
AI
N
News and Events Feed by Topic
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Securelist
B
Blog RSS Feed
Spread Privacy
Spread Privacy
H
Help Net Security
Know Your Adversary
Know Your Adversary
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
V
V2EX
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
博客园 - 叶小钗
D
DataBreaches.Net
T
Troy Hunt's Blog
Project Zero
Project Zero
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Latest news
Latest news
S
Security @ Cisco Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
The GitHub Blog
The GitHub Blog
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
O
OpenAI News
Recorded Future
Recorded Future
Help Net Security
Help Net Security
罗磊的独立博客

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How I Actually Use AI With Python: A Web Dev's Honest Workflow
NDERAKORE5000 · 2026-06-26 · via DEV Community

A question in a Telegram group made me stop and think — and then write this.


Someone in a Python Telegram group I'm part of dropped a question that stuck with me:

"How do you use AI with Python? Does anyone have an interesting workflow? Prompt engineering? Loop engineering? Prompt templates?"

It's a great question — and a surprisingly hard one to answer, because AI is still so new that most of us are figuring it out in real time. Unlike other technological shifts where humanity had centuries to adapt, AI is moving so fast we barely have a decade to even understand what's happening, let alone decide if it's good or bad. But that's a conversation for another post.

The real question here is practical: how do you actually integrate AI into your day-to-day Python work?

I want to share my humble method. I work mostly in web development — Django, templates, frontend components — so everything I describe is centered around that. For other domains, the same principles probably apply, but the specifics will differ. Also worth noting: I only use free, non-local AI services. No paid APIs, no local models.


The Foundation: Always Start With Context

Before any scenario, before any task, I always feed the model the file tree of the project and a short description of what it does. This is non-negotiable. The model needs to know what world it's operating in.

This applies to every session, every task. And it leads directly to the most important lesson I've learned:

Document everything. Save your session URLs. Never repeat the context stage if you don't have to.

I keep the full URL of every AI conversation I use for a project. That way, when I come back the next day — or next week — I can continue where I left off. The model already knows the project. I just pick up the thread.


Scenario 1: Restyling Old or New Django Templates

This is the task I use AI for most. My workflow has three stages.

Stage 1: Study

I feed the model a full collection of approved templates — the ones that come with the admin dashboard or any file that contains clear examples of tables, headers, menus, colors, widgets, and typography.

If the project uses something like AdminLTE, I give the model the technical specs: Bootstrap version, color palette, component structure. If I can, I paste the actual template files.

The goal of this stage isn't just to give information — it's to verify that the model actually understands the project. I do this through questions. I ask the model to describe the UI, the color scheme, the layout patterns. If its answers match reality, we move on.

Stage 2: Production

Once I'm confident the model understands the visual language of the project, I ask it to write a style guide:

"Act as an expert UI/UX designer and write a detailed style guide for this application."

This step forces the model to consolidate everything it learned into a single reference. It's also a final check — if the style guide looks right, the model is ready to work.

Then I ask it to generate a reusable prompt for restyling Django templates:

"Based on what we know about the project, write a prompt for restyling Django templates that: updates styles only and doesn't touch anything else. I want to use it like this: <prompt> <template code>"

From here on, restyling a template is a one-liner. Paste the prompt, paste the template, get the result.

Stage 3: Refinement

The first version of the prompt is rarely perfect. I've run into cases where the model:

  • Removed descriptive titles and subtitles from templates
  • Wrapped content in Bootstrap card containers instead of using full available width

Each time something goes wrong, I add a specific clause to the prompt. Over time, the prompt becomes more precise and the results get closer to what I actually want.


Scenario 2: Building Web Components

Once Scenario 1 is done, Scenario 2 becomes almost trivial — because I already have a working style prompt. Now I just need to adapt it for building native Web Components instead of restyling existing templates.

I ask the model to rewrite the previous prompt for this new purpose:

"I have this prompt. I want you to rewrite it for building Web Components. I want to use it like this: <prompt> {{json}}. The final component should be used like this: <my-component backend-url="{{ url 'endpoint' }}"></my-component>"

The same refinement process applies here. I add clauses for naming consistency, style consistency, and any edge cases that come up in practice.


The Prompts I Actually Use

Here are the two production prompts I've developed through this process.

Prompt: Generate Web Components

Act as an expert Frontend developer specializing in Web Components and clean architecture.
I will provide a JSON structure from a backend endpoint. Your goal is to generate a set of
native Web Components packaged in a single JavaScript file, along with a Django/Bootstrap template.

Follow these rules strictly:

1. ARCHITECTURE:
   - Deliver a single complete file ready to save at static/js/wc_[module]_components.js.
   - Use a single global DashboardStateManager instance to centralize the fetch(url) call
     and avoid duplicate requests. Components must subscribe to this state in connectedCallback.

2. STYLES & RESPONSIVENESS (GENTELELLA STYLE):
   - Use clean fonts and inject a shared style block at the start of each Shadow DOM.
   - Color palette: card backgrounds #ffffff, borders #E6F0F3, body text #73879C,
     headings #2A3F54, accents #26B99A.
   - OVERFLOW GUARD: each card's main container must have width: 100%, box-sizing: border-box.
     For lists or tables with long text: min-width: 0, white-space: nowrap,
     overflow: hidden, text-overflow: ellipsis.
   - Support an orientation attribute ("horizontal" / "vertical") via Flexbox or CSS Grid.

3. ICONS & UTILITIES:
   - Include an ICONS object with raw SVG from Lucide Icons (stroke="currentColor",
     stroke-width="2", no fixed external dimensions). No CDN font libraries.
   - Include helper functions for currency (es-PY, PYG) and dates as needed.

4. COMPONENTS TO GENERATE:
   - <wc-[module]-summary>: Executive banner with dark background (#2A3F54), full width.
   - Specific components for each logical section in the JSON (counters, progress bars, KPIs).
   - <wc-[module]-last-updated>: Compact, elegant sync timestamp display.

5. DJANGO DELIVERABLE:
   - Full HTML block structured inside <div class="container-fluid">.
   - Use Bootstrap rows and columns (col-lg-*, col-md-*, col-sm-12) for clean layout.

Here is the JSON data:
[PASTE YOUR JSON HERE]

Prompt: Restyle Django Templates

Act as an expert Frontend developer specializing in UI/UX and corporate web interfaces.
Your goal is to restyle an existing Django template with a modern visual design,
without altering its logic, server-side tags, or control structures.
Work entirely within the HTML file, 100% self-contained (NO {% include %} tags).

Rules:

1. ABSOLUTE RESPECT FOR LOGIC:
   - Do NOT alter Django tags ({% extends %}, {% block %}, {% csrf_token %}, etc.).
   - Preserve all functional IDs and form attributes.

2. COLOR PALETTE & CSS (injected in {% block head %}):
   - Background: #ffffff | Borders: #E6F0F3 | Text: #73879C | Headings: #2A3F54 | Accent: #26B99A
   - Required classes: .gt-content-wrapper, .x_title_modern, .x_title_left,
     .x_title_actions, .table-responsive-modern, .modern-datatable, .gt-table-actions

3. TITLE CONSISTENCY & RESPONSIVENESS (REQUIRED):
   - .x_title_modern: display flex, flex-wrap wrap, gap 15px, justify-content space-between.
   - Left side (.x_title_left): flex 1, min-width 250px. Contains icon wrapper and <h3> title
     (uppercase, bold, #2A3F54 !important, word-break: break-word) plus a descriptive <p>.
   - Right side (.x_title_actions): reserved for buttons; always present even if empty.

4. TABLE STRUCTURE:
   - Wrap tables in <div class="table-responsive-modern">.
   - Table tag: class="table table-striped table-hover modern-datatable".

5. DELETE/CONFIRM VIEWS:
   - Center form container using grid classes (col-md-10, col-lg-8, mx-auto).
   - Limit form container to max-width: 70% on large screens.
   - Use clear visual alert style (accented left border, soft background).

6. FORMS WITH MODALS, SELECT2 & DATEPICKERS (REQUIRED):
   - Forms inside modals must initialize widgets on shown.bs.modal, NOT document.ready.
   - SELECT2: always use dropdownParent: $('#modalId') inside modals. Never initialize
     on elements with .select2-hidden-accessible.
   - DATERANGEPICKER: use moment.js daterangepicker with singleDatePicker: true,
     autoUpdateInput: false, format DD/MM/YYYY. Listen to apply.daterangepicker event.
     Do NOT use Bootstrap Datepicker — it's not available in this project.
   - If the form has tabs, initialize ALL widgets when the modal loads, not just the active tab.

7. DELIVERABLE:
   - Return the complete HTML, clean and ready to copy-paste as a single professional file.

Here is the current template to restyle:
--- CURRENT TEMPLATE ---
[PASTE YOUR TEMPLATE HERE]


What I've Learned So Far

The good:

  • I can write application logic at full speed without worrying about styling. I build the functionality, then hand the templates to the AI for the visual layer. It's a clean separation that genuinely speeds things up.
  • The context/study stage often surfaces technologies or approaches I hadn't considered. It's not just about getting a task done — it's also a learning moment.
  • A well-maintained session URL is like a project memory. Come back a week later, paste the URL, continue from where you left off — no re-explaining needed.
  • Having the model write the prompt (instead of writing it myself) means the prompt is compatible with other models too. Portability matters.

The constraints:

  • Every AI-assisted workflow requires an upfront context stage. There's no shortcut. The quality of the output is directly tied to the quality of the context you provide.
  • Refinement is ongoing. The first version of any prompt will miss things. You have to run it, see what breaks, and add clauses. Iteration is the process.
  • The session is your source of truth. Keeping everything in one conversation — or at least saving the URL — means you always have a recovery path when something goes wrong or new code needs to be integrated.

Final Thought

This workflow won't suit everyone. It's opinionated, it's centered on Django web development, and it assumes you're willing to invest time upfront in the context stage. But for me, it's changed how I work — not by replacing my judgment, but by letting me move faster and stay focused on what actually matters: the logic, the data, the product.

If you have a different workflow, I'd genuinely love to hear it. That Telegram question is still open.