Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace backslash with forward slash #379

Merged
merged 4 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pcweb/pages/docs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def build_nested_namespace(
continue

# Get the docpage component.
doc = doc.replace("\\", "/")
route = f"/{doc.replace('.md', '')}"
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
Expand Down
20 changes: 20 additions & 0 deletions pcweb/pcweb.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
"""The main Reflex website."""

import os
import sys

import reflex as rx
import reflex.components.radix.themes as rdxt
from pcweb import styles
from pcweb.pages import page404, routes


# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = 125


# Create the app.
app = rx.App(
style=styles.BASE_STYLE,
Expand All @@ -25,6 +34,17 @@
],
)


# XXX: The app is TOO BIG to build on Windows, so explicitly disallow it except for testing
if sys.platform == "win32":
if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
)
routes = routes[:WINDOWS_MAX_ROUTES]


# Add the pages to the app.
for route in routes:
app.add_page(
Expand Down