Skip to content

Commit d917f2e

Browse files
authored
Update freeze.py
1 parent a3ab04a commit d917f2e

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

freeze.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,19 @@
66
from app import app
77

88
# --- Configuration for GitHub Pages ---
9-
# Sets the base URL. CRITICAL for links/CSS/JS on GitHub Pages.
10-
# MUST match your repository name path.
119
print("Setting FREEZER_BASE_URL to '/'")
1210
app.config['FREEZER_BASE_URL'] = '/'
13-
14-
# Sets the output directory for the static files
1511
app.config['FREEZER_DESTINATION'] = 'build'
16-
# Keep .nojekyll file if generated by GitHub Actions
1712
app.config['FREEZER_REMOVE_EXTRA_FILES'] = False
13+
# app.config['FREEZER_FOLLOW_REDIRECTS'] = True # May not be needed if we ignore /search
1814

19-
# *** ADD THIS LINE TO FIX THE REDIRECT ISSUE ***
20-
app.config['FREEZER_FOLLOW_REDIRECTS'] = True # Tell Frozen-Flask to follow 3xx redirects
15+
# *** ADD THIS LINE TO IGNORE THE /search ENDPOINT ***
16+
# 'search' is the function name associated with the @app.route('/search') decorator
17+
app.config['FREEZER_IGNORE_ENDPOINTS'] = ['search']
18+
print("Ignoring endpoint 'search' during freeze.")
19+
# -------------------------------------------------------
2120

22-
# --- Handling Dynamic URLs (IMPORTANT LIMITATION) ---
23-
# Static site generation CANNOT dynamically create pages for every possible
24-
# block, transaction, or address. We MUST provide examples/placeholders
25-
# for Frozen-Flask to generate the *structure* of these pages.
21+
# --- Handling Dynamic URLs ---
2622
freezer = Freezer(app)
2723

2824
@freezer.register_generator
@@ -32,8 +28,9 @@ def transaction_urls():
3228

3329
@freezer.register_generator
3430
def block_urls():
35-
print("Generating static structure for /block/<hash> using placeholder.")
36-
yield {'block_hash': 'placeholder_block_hash_or_number'}
31+
print("Generating static structure for /block/<height> using placeholder.")
32+
# Note: Your route uses height, not block_hash
33+
yield {'height': 0} # Use 0 or another placeholder block number
3734

3835
@freezer.register_generator
3936
def address_urls():
@@ -45,12 +42,12 @@ def address_urls():
4542
print(f"Starting static site generation for pyExplorer...")
4643
print(f"Base URL: {app.config.get('FREEZER_BASE_URL', 'Not Set')}")
4744
print(f"Output directory: {app.config.get('FREEZER_DESTINATION', 'build')}")
48-
print(f"Follow Redirects: {app.config.get('FREEZER_FOLLOW_REDIRECTS', False)}")
4945

5046
try:
5147
freezer.freeze()
5248
print(f"Static site generated successfully in '{app.config['FREEZER_DESTINATION']}'.")
5349
print("NOTE: Only placeholder pages were generated for dynamic routes (/tx, /block, /address).")
50+
print("NOTE: The /search endpoint itself was skipped during generation.")
5451
except Exception as e:
5552
print(f"\nERROR during freezing process: {e}\n", file=sys.stderr)
5653
if isinstance(e, ValueError) and 'URL generator' in str(e):

0 commit comments

Comments
 (0)