Skip to content

Commit

Permalink
fixed links and rebuilt docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Oct 2, 2024
1 parent af5b1e0 commit f1ab8a6
Show file tree
Hide file tree
Showing 50 changed files with 416 additions and 256 deletions.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ Screenshots

Running py4web

.. image:: docs/images/first_run.png
.. image:: https://py4web.com/_documentation/static/en/_images/first_run.png

The main Dashboard

.. image:: docs/images/dashboard_main.png
.. image:: https://py4web.com/_documentation/static/en/_images/dashboard_main.png

Editing a file in the Dashboard

.. image:: docs/images/dashboard_edit.png
.. image:: https://py4web.com/_documentation/static/en/_images/dashboard_edit.png

Editing a database in the Dashboard

.. image:: docs/images/dashboard_restapi.png
.. image:: https://py4web.com/_documentation/static/en/_images/dashboard_restapi.png

Installation
############
Expand Down
2 changes: 1 addition & 1 deletion apps/_documentation/static/en/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 719409c852540c9b2fc6f3ba7d8ee30d
config: 05361d6f8693871fc2dbfcc71260e2ee
tags: 645f666f9bcd5a90fca523b33c5a78b7
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const DOCUMENTATION_OPTIONS = {
VERSION: '20240713',
VERSION: '20240915',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
7 changes: 4 additions & 3 deletions apps/_documentation/static/en/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const Search = {

htmlToText: (htmlString, anchor) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
for (const removalQuery of [".headerlinks", "script", "style"]) {
for (const removalQuery of [".headerlink", "script", "style"]) {
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
}
if (anchor) {
Expand Down Expand Up @@ -328,13 +328,14 @@ const Search = {
for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length)
const score = Math.round(Scorer.title * queryLower.length / title.length);
const boost = titles[file] === title ? 1 : 0; // add a boost for document titles
normalResults.push([
docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "",
null,
score,
score + boost,
filenames[file],
]);
}
Expand Down
8 changes: 4 additions & 4 deletions apps/_documentation/static/en/chapter-01.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>What is py4web? &mdash; py4web 20240713 documentation</title>
<title>What is py4web? &mdash; py4web 20240915 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/tabs.css?v=a5c4661c" />
Expand All @@ -18,7 +18,7 @@

<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=d08cd428"></script>
<script src="_static/documentation_options.js?v=78bb2521"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/toggle.js?v=e1b5a5a1"></script>
Expand All @@ -42,7 +42,7 @@
<img src="_static/logo.png" class="logo" alt="Logo"/>
</a>
<div class="version">
20240713
20240915
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -258,7 +258,7 @@ <h2>Acknowledgments<a class="headerlink" href="#acknowledgments" title="Link to
<label for="switch"></label>
</span>

v: 20240713
v: 20240915
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
Expand Down
8 changes: 4 additions & 4 deletions apps/_documentation/static/en/chapter-02.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Help, resources and hints &mdash; py4web 20240713 documentation</title>
<title>Help, resources and hints &mdash; py4web 20240915 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/tabs.css?v=a5c4661c" />
Expand All @@ -18,7 +18,7 @@

<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=d08cd428"></script>
<script src="_static/documentation_options.js?v=78bb2521"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/toggle.js?v=e1b5a5a1"></script>
Expand All @@ -42,7 +42,7 @@
<img src="_static/logo.png" class="logo" alt="Logo"/>
</a>
<div class="version">
20240713
20240915
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -273,7 +273,7 @@ <h2>How to contribute<a class="headerlink" href="#how-to-contribute" title="Link
<label for="switch"></label>
</span>

v: 20240713
v: 20240915
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
Expand Down
8 changes: 4 additions & 4 deletions apps/_documentation/static/en/chapter-03.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Installation and Startup &mdash; py4web 20240713 documentation</title>
<title>Installation and Startup &mdash; py4web 20240915 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/tabs.css?v=a5c4661c" />
Expand All @@ -18,7 +18,7 @@

<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=d08cd428"></script>
<script src="_static/documentation_options.js?v=78bb2521"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/tabs.js?v=3030b3cb"></script>
Expand All @@ -43,7 +43,7 @@
<img src="_static/logo.png" class="logo" alt="Logo"/>
</a>
<div class="version">
20240713
20240915
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -733,7 +733,7 @@ <h3>Deployment on Ubuntu<a class="headerlink" href="#deployment-on-ubuntu" title
<label for="switch"></label>
</span>

v: 20240713
v: 20240915
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
Expand Down
8 changes: 4 additions & 4 deletions apps/_documentation/static/en/chapter-04.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Dashboard &mdash; py4web 20240713 documentation</title>
<title>The Dashboard &mdash; py4web 20240915 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/tabs.css?v=a5c4661c" />
Expand All @@ -18,7 +18,7 @@

<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=d08cd428"></script>
<script src="_static/documentation_options.js?v=78bb2521"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/toggle.js?v=e1b5a5a1"></script>
Expand All @@ -42,7 +42,7 @@
<img src="_static/logo.png" class="logo" alt="Logo"/>
</a>
<div class="version">
20240713
20240915
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -200,7 +200,7 @@ <h2>Login into the Dashboard<a class="headerlink" href="#login-into-the-dashboar
<label for="switch"></label>
</span>

v: 20240713
v: 20240915
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
Expand Down
49 changes: 43 additions & 6 deletions apps/_documentation/static/en/chapter-05.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Creating an app &mdash; py4web 20240713 documentation</title>
<title>Creating an app &mdash; py4web 20240915 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/tabs.css?v=a5c4661c" />
Expand All @@ -18,7 +18,7 @@

<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=d08cd428"></script>
<script src="_static/documentation_options.js?v=78bb2521"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/toggle.js?v=e1b5a5a1"></script>
Expand All @@ -42,7 +42,7 @@
<img src="_static/logo.png" class="logo" alt="Logo"/>
</a>
<div class="version">
20240713
20240915
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -71,6 +71,7 @@
<li class="toctree-l2"><a class="reference internal" href="#the-scaffold-app">The _scaffold app</a></li>
<li class="toctree-l2"><a class="reference internal" href="#copying-the-scaffold-app">Copying the _scaffold app</a></li>
<li class="toctree-l2"><a class="reference internal" href="#watch-for-files-change">Watch for files change</a></li>
<li class="toctree-l2"><a class="reference internal" href="#domain-mapped-apps">Domain-mapped apps</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="chapter-06.html">Fixtures</a></li>
Expand Down Expand Up @@ -378,8 +379,8 @@ <h2>The _scaffold app<a class="headerlink" href="#the-scaffold-app" title="Link
</div>
<p>Notice the following:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">request</span></code>, <code class="docutils literal notranslate"><span class="pre">response</span></code>, <code class="docutils literal notranslate"><span class="pre">abort</span></code> are defined by
which is a fast bottlepy spin-off.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">request</span></code>, <code class="docutils literal notranslate"><span class="pre">response</span></code>, <code class="docutils literal notranslate"><span class="pre">abort</span></code> are defined by <code class="docutils literal notranslate"><span class="pre">ombott</span></code>
which is a minimal and fast bottlepy spin-off.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">redirect</span></code> and <code class="docutils literal notranslate"><span class="pre">URL</span></code> are similar to their web2py counterparts</p></li>
<li><p>helpers (<code class="docutils literal notranslate"><span class="pre">A</span></code>, <code class="docutils literal notranslate"><span class="pre">DIV</span></code>, <code class="docutils literal notranslate"><span class="pre">SPAN</span></code>, <code class="docutils literal notranslate"><span class="pre">IMG</span></code>, etc) must be imported
from <code class="docutils literal notranslate"><span class="pre">yatl.helpers</span></code> . They work pretty much as in web2py</p></li>
Expand Down Expand Up @@ -464,6 +465,42 @@ <h2>Watch for files change<a class="headerlink" href="#watch-for-files-change" t
function’s parameter is a list of filepaths that were changed. All
exceptions inside handlers are printed in terminal.</p>
</section>
<section id="domain-mapped-apps">
<h2>Domain-mapped apps<a class="headerlink" href="#domain-mapped-apps" title="Link to this heading"></a></h2>
<p>In production environments it is often required to have several apps being
served by a single py4web server, where different apps are mapped to
different domains.</p>
<p>py4web can easily handle running multiple apps, but there is no build-in
mechanism for mapping domains to specific applications. Such mapping needs
to be done externally to py4web – for instance using a web reverse-proxy,
such as nginx.</p>
<p>While nginx or other reverse-proxies are also useful in production
environments for handling SSL termination, caching and other uses,
we cover only the mapping of domains to py4web applications here.</p>
<p>An example nginx configuration for an application <code class="docutils literal notranslate"><span class="pre">myapp</span></code> mapped to
a domain <code class="docutils literal notranslate"><span class="pre">myapp.example.com</span></code> might look like that:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">server {</span>
<span class="go"> listen 80;</span>
<span class="go"> server_name myapp.example.com;</span>
<span class="go"> proxy_http_version 1.1;</span>
<span class="go"> proxy_set_header Host $host;</span>
<span class="go"> proxy_set_header X-PY4WEB-APPNAME /myapp;</span>
<span class="go"> location / {</span>
<span class="go"> proxy_pass http://127.0.0.1:8000/myapp$request_uri;</span>
<span class="go"> }</span>
<span class="go">}</span>
</pre></div>
</div>
<p>This is an example <code class="docutils literal notranslate"><span class="pre">server</span></code> block of nginx configuraiton. One would have to create a separate such block for <strong>each app/each domain</strong> being served by py4web server. Note some important aspects:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">server_name</span></code> defines the domain mapped to the app <code class="docutils literal notranslate"><span class="pre">myapp</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">proxy_http_version</span> <span class="pre">1.1;</span></code> directive is optional, but highly recommended (otherwise nginx uses HTTP 1.0 to talk to the backend-server – here py4web – and it creates all kinds of issues with buffering and otherwise),</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">proxy_set_header</span> <span class="pre">Host</span> <span class="pre">$host;</span></code> directive ensures that the correct <code class="docutils literal notranslate"><span class="pre">Host</span></code> is passed to py4web – here <code class="docutils literal notranslate"><span class="pre">myapp.example.com</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">proxy_set_header</span> <span class="pre">X-PY4WEB-APPNAME</span> <span class="pre">/myapp;</span></code> directive ensures that py4web (and ombott) knows which app to serve and <strong>also</strong> that this application is domain-mapped – pay specific attention to the slash (<code class="docutils literal notranslate"><span class="pre">/</span></code>) in front of the <code class="docutils literal notranslate"><span class="pre">myapp</span></code> name – it is <strong>required</strong> to ensure correct parsing of URLs on ombott level,</p></li>
<li><p>finally <code class="docutils literal notranslate"><span class="pre">proxy_pass</span> <span class="pre">http://127.0.0.1:8000/myapp$request_uri;</span></code> ensures that the request is passed in its entirity (<code class="docutils literal notranslate"><span class="pre">$request_uri</span></code>) to py4web server (here: <code class="docutils literal notranslate"><span class="pre">127.0.0.1:8000</span></code>) and the correct app (<code class="docutils literal notranslate"><span class="pre">/myapp</span></code>).</p></li>
</ul>
<p>Such configuration ensures that all URL manipulation inside ombott and py4web - especially in modules such as <code class="docutils literal notranslate"><span class="pre">Auth</span></code>, <code class="docutils literal notranslate"><span class="pre">Form</span></code>, and <code class="docutils literal notranslate"><span class="pre">Grid</span></code> are done correctly using the domain to which the app is mapped to.</p>
</section>
</section>


Expand Down Expand Up @@ -502,7 +539,7 @@ <h2>Watch for files change<a class="headerlink" href="#watch-for-files-change" t
<label for="switch"></label>
</span>

v: 20240713
v: 20240915
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
Expand Down
Loading

0 comments on commit f1ab8a6

Please sign in to comment.