Sitemap

Using Windsurf to Create a Flask Server

3 min readApr 10, 2025

--

Windsurf AI is like a Gutenberg Press for Servers and Pages

I just started using the Windsurf Editor. It runs on top of Claude 3.5 Sonnet. I create a lot of web servers and web pages to use in teaching. It’s basically the same forumla over and over. I could copy and paste from other existing code. I found working with Windsurf to be a far superior approach.

I’m sharing my process for anyone interested.

I’m showing all the details involved in creating this code. It’s really just a few loosely worded prompts. I had windsurf capture the details for setup in the README.md and the prompts I used in the prompt.md.

I needed to set up a Flask server that hosts static templates. I want to use Bootstrap 5 for CSS. I gave it a few prompts and with in a few minutes it created a virual environment (I just had to “Accept” some commands) and installed the code and an app.py to host a webpage with a header and footer provided by Bootstrap 5.

sample web page
Web Page Served by Flask and Created by Windsurf

I had it document the step it took in my README.

README.md Generated By Windsurf

Flask Bootstrap Template

A simple Flask web application template using Bootstrap 5 for styling. This project demonstrates how to set up a Flask application with templating and Bootstrap integration.

Project Structure

.
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── static/ # Static files directory (CSS, JS, images)
├── templates/ # HTML templates
│ └── index.html # Main template with Bootstrap 5
└── venv/ # Virtual environment

Setup Instructions

  1. Create a virtual environment:
python3 -m venv venv

2. Activate the virtual environment:

  • On macOS/Linux:
source venv/bin/activate
  • On Windows:
venv\Scripts\activate

3. Install dependencies:

pip install -r requirements.txt

4. Run the application:

python app.py

5. Open your browser and navigate to:

http://127.0.0.1:5000

Features

  • Flask 3.0.0 web framework
  • Bootstrap 5 integration via CDN
  • Responsive navigation bar
  • Sticky footer
  • Template inheritance ready
  • Static file serving support

Project Components

app.py

Contains the main Flask application with route definitions and application configuration.

templates/index.html

The main template file that includes:

  • Bootstrap 5 CSS and JS via CDN
  • Responsive navigation bar
  • Main content area
  • Sticky footer

static/

Directory for storing static files such as:

  • Custom CSS files
  • JavaScript files
  • Images
  • Other static assets

Development

To make changes to the template:

1. Ensure your virtual environment is activated

2. Make your changes to the files

3. Flask will automatically reload when you save changes (debug mode is enabled)

Dependencies

- Flask==3.0.0

  • Bootstrap 5 (via CDN)

Documentation of My Prompts in prompts.md

I asked it to collect the prompts I used to create the web server and web page and store in prompts.md

Project Development Prompts

This file records the prompts used to create and develop this project.

Initial Setup

Create a python flask project that uses templates to server html. 
Create a single template for index.html. In the index.html file
add bootstrap 5 css link. Use bootstrap 5 to create a page that has
a nav bar and a footer.

Outcome: Created basic Flask project structure with Bootstrap 5 template, including navbar and footer.

Documentation

create a README.md and add notes about how this was created 
including creation of the virtual environment and the static file

Outcome: Created comprehensive README.md with setup instructions, project structure, and development guidelines.

Git Setup

create a local git environment and add a .gitignore file will 
common items to ignore

Outcome: Initialized git repository and created .gitignore file with common Python-specific ignores.

Documentation Update

create a prompt.md file and record the prompts I've used in the prompt.md

Outcome: Created this prompt.md file to document the development process through prompts.

--

--

Rebecca Peltz
Rebecca Peltz

Written by Rebecca Peltz

Software/Web Engineer and Instructor

Responses (1)