Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 49 minutes ago History
visitors.py · 24.1 KB · 536 lines
1"""/visitors -- did anyone actually turn up?
2
3The existing /analytics page answers "what was requested" from the
4rollups: top paths, top IPs, status codes. This one answers a different
5question, and it is the one an operator asks after telling somebody about
6their server: how many PEOPLE came, when, and from where.
7
8Three things it refuses to do, each because the obvious version misleads:
9
10**It does not report one number.** Unique addresses, undifferentiated,
11are dominated by scanners -- on this server 45% of distinct paths were
12hit exactly once by things probing for /wp-login.php. Visitors, bots and
13our own traffic are counted apart and shown apart, so a quiet day reads
14as a quiet day.
15
16**It does not hide our own hits.** They are labelled, not excluded.
17Seeing your own visit is how you confirm the page is recording anything;
18a counter that silently drops the only traffic you can verify is a
19counter you cannot trust.
20
21**It does not pretend an IP is a person.** The page says so, in words, on
22the page. An office behind one NAT is one visitor and a phone switching
23networks is two. The first-party visitor cookie improves the RETURNING
24question without moving that ceiling at all, and the new-versus-returning
25block says on the page that it is a floor rather than a census: a cleared
26cookie is a new visitor, and this server fingerprints nobody.
27
28Computed live rather than rolled up, deliberately: page_views is capped
29(20k rows on the demo box) so a single pass is cheap, and an operator
30checking whether their announcement worked wants NOW, not "as of the last
31five-minute pass". The one-pass fold lives in object_visitors, which is
32pure and tested; this object renders it.
33
34## Why goals and funnels landed HERE and not on a /funnels of their own
35
36A second page was the obvious move and it is the wrong one. "How many
37came", "how many of them had been before" and "how many of them bought"
38are one question asked at increasing depth, and splitting them puts the
39denominator on one screen and the numerator on another -- a conversion
40rate you have to hold in your head across a navigation is a conversion
41rate nobody computes. The mechanical argument agrees: a /funnels page
42would need its own sign-in refusal, its own capture-is-off branch, its own
43host filter and its own copy of every honesty caveat on this page, and a
44duplicated caveat is a caveat that goes stale on one of the two copies.
45
46What a funnel adds is one settings row (`analytics.funnel_steps`), so a
47shop describes its own without code. When nothing is configured this page
48shows what to configure -- built from the event types actually recorded on
49THIS server, so it can be copied rather than invented -- instead of an
50empty table that reads as "nobody converted".
51"""
52
53import html
54import json
55import os
56
57import object_access
58import object_analytics
59import object_conversions
60import object_records
61import object_visitors
62
63DATA_DIR_ENV = "DBBASIC_DATA_DIR"
64
65_STYLE = """
66.vis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem; }
67.vis-card { border: 1px solid var(--line, #38384a); border-radius: 8px; padding: .8rem; }
68.vis-card .n { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
69.vis-card .k { font-size: .8rem; opacity: .7; }
70.vis-table { width: 100%; border-collapse: collapse; margin: .4rem 0 1.5rem; }
71.vis-table th, .vis-table td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid var(--line, #38384a); font-variant-numeric: tabular-nums; }
72.vis-table td.num, .vis-table th.num { text-align: right; }
73.bar { display: inline-block; height: .7rem; background: var(--accent, #b5713a); border-radius: 2px; vertical-align: middle; }
74.bar.bot { background: var(--line, #55556a); }
75.quiet td { opacity: .45; }
76.vis-note { border-left: 3px solid var(--accent, #b5713a); padding: .1rem 0 .1rem .7rem; margin: .4rem 0 1.2rem; font-size: .85rem; opacity: .85; }
77.vis-setup { border: 1px dashed var(--line, #38384a); border-radius: 8px; padding: .8rem 1rem; margin: .4rem 0 1.5rem; }
78.vis-setup pre { overflow-x: auto; font-size: .8rem; }
79"""
80
81
82def _esc(value):
83 return html.escape(str(value if value is not None else ""), quote=True)
84
85
86def _data_dir():
87 return os.environ.get(DATA_DIR_ENV, object_records.DEFAULT_DATA_DIR)
88
89
90def _bar(count, peak, *, bot=False):
91 if not count or not peak:
92 return ""
93 width = max(2, round(120 * count / peak))
94 return f'<span class="bar{" bot" if bot else ""}" style="width:{width}px"></span>'
95
96
97def _series_rows(series, *, label_slice=None, hide_empty=False):
98 peak = max([row["visitors"] for row in series] or [0]) or 1
99 out = []
100 for row in series:
101 if hide_empty and not (row["visitors"] or row["bots"] or row["operator_views"]):
102 continue
103 quiet = "" if row["visitors"] else ' class="quiet"'
104 label = row["bucket"][label_slice] if label_slice else row["bucket"]
105 out.append(
106 f"<tr{quiet}><td>{_esc(label)}</td>"
107 f'<td class="num">{row["visitors"]}</td>'
108 f'<td>{_bar(row["visitors"], peak)}</td>'
109 f'<td class="num">{row["views"]}</td>'
110 f'<td class="num">{row["bots"]}</td>'
111 f'<td class="num">{row["operator_views"]}</td></tr>')
112 return "".join(out) or '<tr><td colspan="6" class="hint">Nothing recorded.</td></tr>'
113
114
115# --- goals, funnels and the returning visitor ---------------------------------
116
117def _rows(collection, base):
118 """A collection's rows, or None when it cannot be read at all.
119
120 None is not an empty list here. A missing `conversions` collection
121 means app-analytics' schema was never installed, and rendering that as
122 "0 conversions" would be the exact failure this whole page is written
123 against: a confident zero where the truth is "nothing was ever
124 recorded".
125 """
126 try:
127 # access: the conversions caller filters the rows through Access.visible
128 return object_records.read_collection_records(collection, base_dir=base)
129 except Exception:
130 return None
131
132
133def _setting(base, key):
134 """Duplicated on purpose, like every other package that reads
135 app_settings -- see docs/logic-decisions.md #4."""
136 try:
137 # access: box configuration
138 for row in object_records.read_collection_records("app_settings",
139 base_dir=base):
140 if row.get("key") == key and str(row.get("value") or "").strip():
141 return str(row["value"]).strip()
142 except Exception:
143 pass
144 return ""
145
146
147def _cookie_note():
148 """What this box asks a browser to remember, folded from the setting
149 rather than asserted. The old wording said "the one thing this server
150 does ask a browser to remember is a first-party cookie" as a flat
151 fact; with the cookie defaulted off that sentence was false on every
152 default install, and an analytics page that misdescribes its own
153 collection is the failure this whole package is written against."""
154 if not object_analytics.visitor_cookie_enabled():
155 return ("This server asks the browser to remember nothing at all for "
156 "analytics: the first-party "
157 f"<code>{_esc(object_analytics.VISITOR_COOKIE_NAME)}</code> "
158 "cookie is off, which is the default, so every visit looks new "
159 "and no identifier is stored on anybody's device.")
160 return ("The one thing this server does ask a browser to remember is a "
161 "first-party "
162 f"<code>{_esc(object_analytics.VISITOR_COOKIE_NAME)}</code> cookie — "
163 "an opaque token, HttpOnly, SameSite, "
164 f"{object_analytics.visitor_days()} days, never set for anyone "
165 "sending Do Not Track or Global Privacy Control, and never joined "
166 "to a signed-in account. It makes returning visitors countable and "
167 "it does not raise the ceiling: it still cannot tell a phone from a "
168 "laptop, and nobody is fingerprinted.")
169
170
171def _caveat_tail(caveat):
172 """The caveat minus its own headline, so the page can bold the
173 headline and keep the sentence. Read from the fold rather than
174 retyped: two copies of an honesty note is one copy that goes stale."""
175 tail = caveat.split(":", 1)[-1].strip()
176 return tail[:1].upper() + tail[1:]
177
178
179def _returning_block(rows, days):
180 # New-versus-returning is the one number the visitor cookie buys, so
181 # with the cookie off it is not a zero -- it is a question this box
182 # deliberately does not ask. Rendering "0% returning" here would be
183 # exactly the confident-zero failure the rest of this page is written
184 # against, and it would also be the page quietly disagreeing with
185 # /privacy, which says no identifier is stored.
186 if not object_analytics.visitor_cookie_enabled():
187 return f"""
188<h2 style="font-size:1rem">New versus returning</h2>
189<p class="vis-note"><strong>Not measured on this server.</strong> The
190first-party <code>{_esc(object_analytics.VISITOR_COOKIE_NAME)}</code> cookie is
191off (the default), so nothing is stored on a visitor's device and a returning
192visitor is indistinguishable from a new one. Everything above still works —
193this is the one question that goes away. Setting
194<code>{_esc(object_analytics.VISITOR_COOKIE_ENV)}=on</code> answers it, and
195{_esc(object_analytics.OBLIGATION)}. See <a href="/privacy">/privacy</a>, which
196states whichever of the two you chose.</p>
197"""
198 fold = object_conversions.returning_visitors(rows, window_days=days)
199 cards = "".join(
200 f'<div class="vis-card"><div class="n">{value}</div>'
201 f'<div class="k">{_esc(label)}</div></div>'
202 for label, value in (
203 ("new (cookie seen once)", fold["new"]),
204 ("returning", fold["returning"]),
205 ("% returning", f'{fold["returning_pct"]}%'),
206 ("addresses with no cookie", fold["no_token_addresses"]),
207 ))
208 return f"""
209<h2 style="font-size:1rem">New versus returning</h2>
210<div class="vis-grid">{cards}</div>
211<p class="vis-note"><strong>A floor, never a census.</strong>
212{_esc(_caveat_tail(object_conversions.FLOOR_CAVEAT))}
213The {fold["no_token_addresses"]} address(es) with no cookie are visitors who
214sent Do Not Track or Global Privacy Control, clients that keep no cookies,
215and traffic recorded before the cookie existed — they are counted as
216visitors above and cannot appear on either side of this split.</p>
217"""
218
219
220def _goals_block(conversions, days):
221 if conversions is None:
222 return """
223<h2 style="font-size:1rem">Goals</h2>
224<p class="hint">No <code>conversions</code> collection on this server — install
225app-analytics' schema. Nothing before that moment can be recovered, because
226nothing was written.</p>
227"""
228 summary = object_conversions.by_event_type(conversions, window_days=days)
229 body = "".join(
230 f'<tr><td><code>{_esc(row["event_type"])}</code></td>'
231 f'<td class="num">{row["count"]}</td>'
232 f'<td class="num">{row["threaded"]}</td>'
233 f'<td><time datetime="{_esc(row["last"])}">'
234 f'{_esc(row["last"][:16].replace("T", " "))}</time></td></tr>'
235 for row in summary
236 ) or ('<tr><td colspan="4" class="hint">No conversions recorded in this '
237 'window. Goals are written by a transition — an order confirmed, a '
238 'payment received, a scan confirmed — so this stays empty until one '
239 'happens with the change dispatcher running.</td></tr>')
240 return f"""
241<h2 style="font-size:1rem">Goals</h2>
242<table class="vis-table">
243<thead><tr><th>Event</th><th class="num">Count</th>
244<th class="num">Threaded</th><th>Last</th></tr></thead>
245<tbody>{body}</tbody></table>
246<p class="hint"><strong>Threaded</strong> is how many carry a visitor token and
247can therefore appear in a funnel. A goal recorded by a back-office transition
248has no browser anywhere near it, so it counts here and cannot be attributed to
249a visitor — said out loud rather than left to explain a funnel that looks
250broken.</p>
251"""
252
253
254def _funnel_setup(conversions, summary):
255 """What to configure, built from what this server has actually seen.
256
257 An empty funnel table would read as "nobody converted". An example
258 made of paths and event types this box has really recorded can be
259 copied straight into the setting, which is the difference between
260 documentation and a next step.
261 """
262 landing = [row["path"] for row in summary["landing"][:2]] or ["/"]
263 events = [row["event_type"]
264 for row in object_conversions.by_event_type(conversions or [])[:1]]
265 example = json.dumps(landing + (events or ["order_confirmed"]))
266 return f"""
267<h2 style="font-size:1rem">Funnel</h2>
268<div class="vis-setup">
269<p style="margin-top:0">No funnel is configured, so there is nothing to show —
270which is not the same as nobody converting. A funnel is a settings row, not
271code: add <code>{_esc(object_conversions.FUNNEL_STEPS_SETTING)}</code> to
272<a href="/collections/app_settings/records">app settings</a> as a JSON list of
273ordered steps. A step beginning with <code>/</code> is a path prefix; anything
274else is a conversion <code>event_type</code>.</p>
275<pre><code>{_esc(example)}</code></pre>
276<p class="hint" style="margin-bottom:0">Steps built from what this server has
277actually recorded, so it can be copied rather than invented. The long form
278takes labels: <code>[{{"label": "Browsed", "path": "/shop"}}, …]</code>.</p>
279</div>
280"""
281
282
283def _timing_block(page_views, conversions):
284 fold = object_conversions.time_to_conversion(page_views, conversions or [])
285 if not fold["count"]:
286 return ""
287 cards = "".join(
288 f'<div class="vis-card"><div class="n">{value}</div>'
289 f'<div class="k">{_esc(label)}</div></div>'
290 for label, value in (
291 ("median days to convert", fold["median_days"]),
292 ("quarter convert within", fold["p25_days"]),
293 ("three quarters within", fold["p75_days"]),
294 ("same-day conversions", fold["same_day"]),
295 ))
296 caveats = "".join(f'<p class="vis-note">{_esc(text)}</p>'
297 for text in fold["caveats"])
298 return f"""
299<h2 style="font-size:1rem">Time to conversion</h2>
300<div class="vis-grid">{cards}</div>
301<p class="hint">Days between a visitor's first recorded page and their
302conversion, over the {fold["count"]} conversion(s) that carry a visitor token
303AND still have a first page view in the log. A median of zero is a shop people
304buy from on arrival; a median of nine is a decision somebody goes away and
305thinks about.</p>
306{caveats}
307"""
308
309
310def _funnel_row(row):
311 """One step. The first step has no drop-off — it is the denominator,
312 and rendering "0% lost" there invites reading it as a step everyone
313 passed rather than as the population everything else is measured
314 against."""
315 lost = "" if row["drop_off_pct"] is None else str(row["drop_off"])
316 pct = "" if row["drop_off_pct"] is None else f'{row["drop_off_pct"]}%'
317 return (f'<tr><td>{_esc(row["label"])}</td>'
318 f'<td><code>{_esc(row["match"])}</code></td>'
319 f'<td class="num">{row["visitors"]}</td>'
320 f'<td class="num">{row["of_entered_pct"]}%</td>'
321 f'<td class="num">{lost}</td>'
322 f'<td class="num">{pct}</td>'
323 f'<td class="num">{row["ip_stitched"]}</td></tr>')
324
325
326def _funnel_block(page_views, conversions, summary, base):
327 raw = _setting(base, object_conversions.FUNNEL_STEPS_SETTING)
328 steps, error = object_conversions.parse_funnel_steps(raw)
329 if error:
330 return f"""
331<h2 style="font-size:1rem">Funnel</h2>
332<p class="vis-note"><code>{_esc(object_conversions.FUNNEL_STEPS_SETTING)}</code>
333could not be read: {_esc(error)}. Said out loud rather than shown as an empty
334funnel — a misconfigured funnel and a funnel nobody entered look identical, and
335only one of them is your fault.</p>
336"""
337 if not steps:
338 return _funnel_setup(conversions, summary)
339
340 fold = object_conversions.funnel(page_views, conversions or [], steps)
341 body = "".join(_funnel_row(row) for row in fold["steps"])
342 caveats = "".join(f'<p class="vis-note">{_esc(text)}</p>'
343 for text in fold["caveats"])
344 return f"""
345<h2 style="font-size:1rem">Funnel</h2>
346<table class="vis-table">
347<thead><tr><th>Step</th><th>Matches</th><th class="num">Visitors</th>
348<th class="num">Of first</th><th class="num">Lost</th>
349<th class="num">Drop-off</th><th class="num">IP-stitched</th></tr></thead>
350<tbody>{body}</tbody></table>
351<p class="hint">Threaded by the visitor cookie, falling back to the IP address
352for rows that carry none — the <strong>IP-stitched</strong> column is how much
353of each step is that fallback. An IP is not a person: an office behind one
354connection is one very decisive shopper. Steps are a sequence, so a visitor
355counts at a step only if they reached the one before it and did this one
356afterwards.</p>
357{caveats}
358"""
359
360
361def GET(request):
362 identity = request.get("_identity", {}) or {}
363 user_id = identity.get("user_id")
364 if not user_id:
365 body = ('<p class="hint"><a href="/login?next=/visitors">Sign in</a> '
366 'to see visitor numbers.</p>')
367 return _page(body)
368
369 # page_views and conversions are admin-read collections; this page
370 # reads them from storage, so it asks the permission engine the
371 # question the API would. Signed in was the only gate, and any
372 # registered user got the traffic, landing paths and funnel the API
373 # refuses them (bug-reports/2026-11-28-06-14-41). A caller the policy
374 # does not let read page_views at all is told so rather than shown a
375 # board of zeros, which would read as "nobody came"; one it lets read
376 # SOME rows (a filtered rule, none ships today) sees those rows only.
377 access = object_access.Access(identity, base_dir=_data_dir())
378 if not access.can("read", object_analytics.PAGE_VIEWS_COLLECTION, None):
379 return _page('<p class="hint">Visitor numbers are for the people who '
380 'run this server. Your account cannot read page views; '
381 'an administrator can.</p>')
382
383 if not object_analytics.analytics_enabled():
384 return _page('<p class="hint">Analytics capture is off. Set '
385 '<code>DBBASIC_ANALYTICS=on</code> to start recording '
386 'page views; nothing before that moment can be recovered, '
387 'because nothing was written.</p>')
388
389 try:
390 rows = access.visible(
391 object_analytics.PAGE_VIEWS_COLLECTION,
392 object_records.read_collection_records(
393 object_analytics.PAGE_VIEWS_COLLECTION, base_dir=_data_dir()))
394 except Exception:
395 return _page('<p class="hint">No page_views collection yet — install '
396 'app-analytics and let one request through.</p>')
397
398 try:
399 days = max(1, min(31, int(str(request.get("days") or 7))))
400 except (TypeError, ValueError):
401 days = 7
402
403 host = str(request.get("host") or "").strip().lower()
404 summary = object_visitors.summarize(rows, days=days, host=host)
405 totals = summary["totals"]
406 retention = object_analytics.retention_days()
407
408 # Everything below the traffic tables is scoped to the same host, so a
409 # per-site view cannot show one site's visitors above another site's
410 # funnel. Conversions carry no host of their own -- they are recorded
411 # by a transition, not a request -- so they are not filtered, and the
412 # funnel says how much of itself it could attribute.
413 base = _data_dir()
414 scoped = ([row for row in rows if str(row.get("host") or "") == host]
415 if host else rows)
416 conversions = _rows(object_conversions.CONVERSIONS_COLLECTION, base)
417 if conversions is not None: # None is "never installed", kept apart
418 conversions = access.visible(
419 object_conversions.CONVERSIONS_COLLECTION, conversions)
420
421 cards = "".join(
422 f'<div class="vis-card"><div class="n">{value}</div>'
423 f'<div class="k">{_esc(label)}</div></div>'
424 for label, value in (
425 (f"unique visitors, {days}d", totals["visitor"]["unique"]),
426 (f"visitor page views, {days}d", totals["visitor"]["views"]),
427 ("bot addresses", totals["bot"]["unique"]),
428 ("your own requests", totals["operator"]["views"]),
429 ))
430
431 referrers = "".join(
432 f'<tr><td>{_esc(row["referrer"])}</td>'
433 f'<td class="num">{row["visitors"]}</td></tr>'
434 for row in summary["referrers"]
435 ) or '<tr><td colspan="2" class="hint">No visitors yet in this window.</td></tr>'
436
437 landing = "".join(
438 f'<tr><td><code>{_esc(row["path"])}</code></td>'
439 f'<td class="num">{row["visitors"]}</td></tr>'
440 for row in summary["landing"]
441 ) or '<tr><td colspan="2" class="hint">No pages loaded by a visitor yet.</td></tr>'
442
443 hosts = "".join(
444 f'<tr><td><a href="/visitors?days={days}&host={_esc(row["host"])}">'
445 f'{_esc(row["host"])}</a></td>'
446 f'<td class="num">{row["visitors"]}</td></tr>'
447 for row in summary["hosts"]
448 ) or '<tr><td colspan="2" class="hint">No visitors yet in this window.</td></tr>'
449
450 head = ('<thead><tr><th>When</th><th class="num">Visitors</th><th></th>'
451 '<th class="num">Views</th><th class="num">Bots</th>'
452 '<th class="num">Yours</th></tr></thead>')
453
454 body = f"""
455<div class="breadcrumb"><a href="/">Home</a> / Visitors</div>
456<div class="pagehead"><h1>Visitors{" &middot; " + _esc(host) if host else ""}</h1>
457 <span class="muted">last {days} days &middot;
458 <a href="/visitors?days=1">1</a> &middot; <a href="/visitors?days=7">7</a> &middot;
459 <a href="/visitors?days=30">30</a></span></div>
460
461<div class="vis-grid">{cards}</div>
462
463{'<p class="hint"><a href="/visitors?days=' + str(days) + '">&larr; all sites</a></p>' if host else ''}
464<h2 style="font-size:1rem">Which site</h2>
465<p class="hint" style="margin-top:0">One process answers for more than one
466hostname here, so a combined figure answers neither "did anyone read the
467pitch" nor "did anyone try the product".</p>
468<table class="vis-table">
469<thead><tr><th>Host</th><th class="num">Visitors</th></tr></thead>
470<tbody>{hosts}</tbody></table>
471
472<h2 style="font-size:1rem">Today, by hour (UTC)</h2>
473<table class="vis-table">{head}<tbody>
474{_series_rows(summary["hours"], label_slice=slice(11, 13), hide_empty=True)}
475</tbody></table>
476
477<h2 style="font-size:1rem">By day</h2>
478<table class="vis-table">{head}<tbody>
479{_series_rows(summary["days"])}
480</tbody></table>
481
482<h2 style="font-size:1rem">Where visitors came from</h2>
483<table class="vis-table">
484<thead><tr><th>Referrer</th><th class="num">Visitors</th></tr></thead>
485<tbody>{referrers}</tbody></table>
486
487<h2 style="font-size:1rem">What they landed on</h2>
488<table class="vis-table">
489<thead><tr><th>Page</th><th class="num">Visitors</th></tr></thead>
490<tbody>{landing}</tbody></table>
491
492{_returning_block(scoped, days)}
493{_goals_block(conversions, days)}
494{_funnel_block(scoped, conversions, summary, base)}
495{_timing_block(scoped, conversions)}
496
497<p class="hint">A <strong>visitor</strong> is an address that loaded a real
498page <em>and</em> did one thing a prober does not — opened a second page,
499arrived from a referrer, or carried a session. A lone hit on
500<code>/</code> is not counted, because <code>/</code> answers 200 to
501everyone. A <strong>bot</strong> is everything else: scanners walking a
502list of URLs that do not exist here, declared crawlers, and anything
503sending an attack payload in a header. <strong>Yours</strong> is traffic from an
504owner address or carrying the admin token, shown rather than hidden so you
505can check the page is recording at all.</p>
506<p class="hint">Unique means distinct IP address, which is an
507approximation and not a person: an office behind one connection counts
508once, a phone moving between wifi and cellular counts twice. {_cookie_note()}
509Page views are kept for {retention} days
510&middot; <a href="/analytics">path and status detail</a>
511&middot; <a href="/privacy">what visitors are told</a>.</p>
512"""
513 return _page(body)
514
515
516def _page(body):
517 return {
518 "content_type": "text/html; charset=utf-8",
519 "body": f"""<!doctype html>
520<html lang="en">
521<head>
522<meta charset="utf-8">
523<meta name="viewport" content="width=device-width, initial-scale=1">
524<title>Visitors</title>
525<link rel="stylesheet" href="/style">
526<style>{_STYLE}</style>
527</head>
528<body>
529<div class="wrap">
530<header class="app"><h1><a href="/">DBBASIC</a></h1></header>
531{body}
532</div>
533<script src="/nav"></script>
534</body>
535</html>""",
536 }