or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

configuration.mdcore-freezing.mdindex.mdurl-generation.mdutilities.md

index.mddocs/

0

# Frozen-Flask

1

2

Frozen-Flask transforms Flask web applications into static websites by generating static HTML files from all accessible URLs. It provides a comprehensive freezing system with configurable URL generators, automatic static file handling, and support for custom routing patterns.

3

4

## Package Information

5

6

- **Package Name**: Frozen-Flask

7

- **Package Type**: pypi

8

- **Language**: Python

9

- **Installation**: `pip install Frozen-Flask`

10

- **Dependencies**: Flask >=2.0.0

11

12

## Core Imports

13

14

```python

15

from flask_frozen import Freezer

16

```

17

18

Complete import for all public functionality:

19

20

```python

21

from flask_frozen import Freezer, walk_directory, relative_url_for

22

```

23

24

## Basic Usage

25

26

```python

27

from flask import Flask

28

from flask_frozen import Freezer

29

30

# Create Flask app

31

app = Flask(__name__)

32

33

@app.route('/')

34

def index():

35

return '<h1>Hello World!</h1>'

36

37

@app.route('/page/<name>/')

38

def page(name):

39

return f'<h1>Page: {name}</h1>'

40

41

# Initialize freezer

42

freezer = Freezer(app)

43

44

# Register URL generator for dynamic routes

45

@freezer.register_generator

46

def page_urls():

47

yield 'page', {'name': 'about'}

48

yield 'page', {'name': 'contact'}

49

50

# Freeze the application to static files

51

if __name__ == '__main__':

52

freezer.freeze() # Generates static files in 'build/' directory

53

```

54

55

## Architecture

56

57

Frozen-Flask operates through a flexible URL generation system that discovers and processes all URLs in a Flask application:

58

59

- **Freezer**: Core class that orchestrates the freezing process, managing URL discovery, file generation, and build output

60

- **URL Generators**: Functions that yield URLs or endpoint patterns to be processed during freezing

61

- **Build Process**: Systematic generation of static files from Flask responses, with support for incremental builds and smart file comparison

62

- **Configuration System**: Extensive configuration options for customizing build behavior, file handling, and URL processing

63

64

The library automatically handles static files, applies URL generators for dynamic routes, and provides hooks for custom URL generation patterns, making it suitable for converting any Flask application into a deployable static website.

65

66

## Capabilities

67

68

### Core Freezing Operations

69

70

Primary functionality for converting Flask applications to static sites, including the main Freezer class, build process control, and URL discovery mechanisms.

71

72

```python { .api }

73

class Freezer:

74

def __init__(self, app=None, with_static_files=True,

75

with_no_argument_rules=True, log_url_for=True): ...

76

def init_app(self, app): ...

77

def freeze(self): ...

78

def freeze_yield(self): ...

79

def all_urls(self): ...

80

```

81

82

[Core Freezing](./core-freezing.md)

83

84

### URL Generation and Registration

85

86

Advanced URL generation system for handling dynamic routes, custom URL patterns, and endpoint discovery.

87

88

```python { .api }

89

def register_generator(self, function): ...

90

def static_files_urls(self): ...

91

def no_argument_rules_urls(self): ...

92

```

93

94

[URL Generation](./url-generation.md)

95

96

### Configuration and Customization

97

98

Comprehensive configuration system for controlling build behavior, file handling, error processing, and output customization.

99

100

```python { .api }

101

# Configuration options set automatically on app.config

102

FREEZER_DESTINATION: str

103

FREEZER_BASE_URL: str

104

FREEZER_RELATIVE_URLS: bool

105

FREEZER_REMOVE_EXTRA_FILES: bool

106

```

107

108

[Configuration](./configuration.md)

109

110

### Utility Functions

111

112

Helper functions for directory operations, relative URL generation, and file system utilities.

113

114

```python { .api }

115

def walk_directory(root, ignore=()): ...

116

def relative_url_for(endpoint, **values): ...

117

```

118

119

[Utilities](./utilities.md)

120

121

## Error Handling

122

123

Frozen-Flask provides a comprehensive warning system for common issues:

124

125

```python { .api }

126

class FrozenFlaskWarning(Warning): ...

127

class MissingURLGeneratorWarning(FrozenFlaskWarning): ...

128

class MimetypeMismatchWarning(FrozenFlaskWarning): ...

129

class NotFoundWarning(FrozenFlaskWarning): ...

130

class RedirectWarning(FrozenFlaskWarning): ...

131

```

132

133

These warnings help identify missing URL generators, MIME type conflicts, 404 responses, and redirect handling issues during the build process.