How I Use AI with Python: A Web Dev Workflow
A question in a Telegram group made me rethink my entire process.
Someone asked: "How do you actually use AI with Python? Do you use prompt engineering or templates?"
Most people struggle with this because AI changes too fast. I do not use paid APIs or local models. I use free web services. My workflow focuses on Django web development.
Here is my exact method.
Step 1: Build the Context Before any task, I feed the model my project file tree and a short description. The model must know the environment.
Step 2: Save Everything I save the URL of every AI conversation. If I return to a project a week later, I paste the link. The model already knows the project. I do not waste time repeating context.
Step 3: The Visual Verification I do not just ask for code. I give the model my approved UI templates and technical specs like Bootstrap versions and color palettes.
I then ask the model to describe my UI. If its description matches my actual project, it understands.
Step 4: Create a Style Guide I ask the model to act as a UI/UX designer and write a detailed style guide based on the project. This forces the model to consolidate its knowledge.
Step 5: Build Reusable Prompts I ask the model to write a prompt for me. For example, I ask it to create a prompt that restyles Django templates without touching the logic.
Once this prompt works, restyling a page becomes a one-liner. I paste the prompt, paste the code, and get the result.
My Two Main Production Prompts:
The Web Component Prompt: Used to turn JSON data into native Web Components. It includes specific rules for architecture, colors, and icons.
The Template Restyler Prompt: Used to update the look of existing Django templates. It strictly protects server-side tags and logic while injecting new CSS.
Why this works:
- Speed: I write application logic while the AI handles the visual layer.
- Learning: The context stage teaches me new technical approaches.
- Portability: Because the model writes the prompts, they work across different AI services.
The Reality:
You cannot skip the setup phase. The quality of the output depends on the quality of your context. The first prompt is rarely perfect. You must run it, find the errors, and add rules to fix them.
This workflow allows me to focus on logic and data instead of fighting with CSS.
Optional learning community: https://t.me/GyaanSetuAi
