<p>The webclient runs as part of the <aclass="reference internal"href="Portal-And-Server.html"><spanclass="doc std std-doc">Server</span></a> process of
<li><p>The <aclass="reference internal"href="Web-Admin.html"><spanclass="doc std std-doc">Web Admin</span></a> is based on the Django web admin and allows you to
<li><p>The <aclass="reference internal"href="Webclient.html"><spanclass="doc std std-doc">Webclient</span></a> page is served by the webserver, but the actual
<li><p>The <aclass="reference internal"href="Web-API.html"><spanclass="doc std std-doc">Evennia REST-API</span></a> allows for accessing the database from outside the game
<h2>Basic Webserver data flow<aclass="headerlink"href="#basic-webserver-data-flow"title="Permalink to this headline">¶</a></h2>
<olclass="simple">
<li><p>A user enters an url in their browser (or clicks a button). This leads to
the browser sending a <em>HTTP request</em> to the server containing an url-path
(like for <codeclass="docutils literal notranslate"><spanclass="pre">https://localhost:4001/</span></code>, the part of the url we need to consider
<codeclass="docutils literal notranslate"><spanclass="pre">/</span></code>). Other possibilities would be <codeclass="docutils literal notranslate"><spanclass="pre">/admin/</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">/login/</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">/channels/</span></code> etc.</p></li>
<li><p>evennia (through Django) will make use of the regular expressions registered
in the <codeclass="docutils literal notranslate"><spanclass="pre">urls.py</span></code> file. This acts as a rerouter to <em>views</em>, which are
regular Python functions or callable classes able to process the incoming
request (think of these as similar to the right Evennia Command being
selected to handle your input - views are like Commands in this sense). In
the case of <codeclass="docutils literal notranslate"><spanclass="pre">/</span></code> we reroute to a view handling the main index-page of the
website.</p></li>
<li><p>The view code will prepare all the data needed by the web page. For the default
index page, this means gather the game statistics so you can see how many
are currently connected to the game etc.</p></li>
<li><p>The view will next fetch a <em>template</em>. A template is a HTML-document with special
‘placeholder’ tags (written as <codeclass="docutils literal notranslate"><spanclass="pre">{{...}}</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">{%</span><spanclass="pre">...</span><spanclass="pre">%}</span></code> usually). These
placeholders allow the view to inject dynamic content into the HTML and make
the page customized to the current situation. For the index page, it means
injecting the current player-count in the right places of the html page. This
is called ‘rendering’ the template. The result is a complete HTML page.</p></li>
<li><p>(The view can also pull in a <em>form</em> to customize user-input in a similar way.)</p></li>
<li><p>The finished HTML page is packed into a <em>HTTP response</em> and returned to the
web browser, which can now display the page!</p></li>
</ol>
<sectionid="a-note-on-the-webclient">
<h3>A note on the webclient<aclass="headerlink"href="#a-note-on-the-webclient"title="Permalink to this headline">¶</a></h3>
<p>The web browser can also execute code directly without talking to the Server.
This code must be written/loaded into the web page and is written using the
Javascript programming language (there is no way around this, it is what web
browsers understand). Executing Javascript is something the web browser does,
it operates independently from Evennia. Small snippets of javascript can be
used on a page to have buttons react, make small animations etc that doesn’t
<p>In the case of the <aclass="reference internal"href="Webclient.html"><spanclass="doc std std-doc">Webclient</span></a>, Evennia will load the Webclient page