Skip to content

sourcegraph/training-cody-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Refactor Demo

This example demonstrates Cody's ability to refactor an existing codebase, adding tests and new functionality quickly and effectively.

Application Structure

The application is built with Flask and organized using a blueprint architecture:

  • app.py - Main application entry point that configures Flask and registers blueprints
  • flask_refactor/routes/main.py - Contains the main blueprint for web routes
  • flask_refactor/routes/api.py - Contains the API blueprint for API endpoints
  • flask_refactor/templates/ - Contains HTML templates
  • flask_refactor/static/ - Contains static assets (CSS, JS, images)

Setup Instructions

Setting up a virtual environment with uv

uv is a fast Python package installer and resolver. Follow these steps to set up your environment:

  1. Install uv (if not already installed):
pip install uv
  1. Create a virtual environment:
uv venv
  1. Activate the virtual environment:
source .venv/bin/activate

On Windows, use:

.venv\Scripts\activate
  1. Install dependencies:
uv pip install -r requirements.txt

Running the Application

After setting up the environment and installing dependencies:

python app.py

The application will start in debug mode and be accessible at http://127.0.0.1:5000/

Development

The application uses Flask's blueprint structure to organize routes:

  • Main blueprint handles web pages
  • API blueprint handles API endpoints

To add new routes, extend the appropriate blueprint files in the flask_refactor/routes/ directory.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors