Skip to content

Commit

Permalink
Deploying to gh-pages from @ litestar-org/litestar@b09a549 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin committed Jan 10, 2025
1 parent 34c121e commit bd47d48
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
16 changes: 8 additions & 8 deletions 3940/_sources/migration/flask.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ Request methods
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.environ`` | ``request.scope`` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.files`` | Use ```UploadFile`` <usage/requests/file-uploads>`__ |
| ``request.files`` | Use ``UploadFile`` see in :doc:`/usage/requests` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.form`` | ``request.form()``, prefer ```Body`` <usage/requests/content-type>`__ |
| ``request.form`` | ``request.form()``, prefer ``Body`` see in :doc:`/usage/requests` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.get_json`` | ``request.json()``, prefer the ```data keyword argument`` <usage/requests/request-body>`__ |
| ``request.get_json`` | ``request.json()``, prefer the ``data`` keyword argument, see in :doc:`/usage/requests` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.headers`` | ``request.headers`` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -276,11 +276,11 @@ in Litestar.
.. code-block:: python
from litestar import Litestar
from litestar.static_files import StaticFilesConfig
from litestar.static_files import create_static_files_router
app = Litestar(
[], static_files_config=[StaticFilesConfig(path="/static", directories=["static"])]
)
app = Litestar route_handlers=[
create_static_files_router(path="/static", directories=["assets"]),
])
.. seealso::

Expand Down Expand Up @@ -447,7 +447,7 @@ For redirects, instead of ``redirect`` use ``Redirect``:
@get("/hello")
def hello() -> Redirect:
return Redirect(path="index")
return Redirect(path="/")
app = Litestar([index, hello])
Expand Down
16 changes: 8 additions & 8 deletions 3940/migration/flask.html
Original file line number Diff line number Diff line change
Expand Up @@ -1750,13 +1750,13 @@ <h3>Request methods<a class="headerlink" href="#request-methods" title="Permalin
<td><p><code class="docutils literal notranslate"><span class="pre">request.scope</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">request.files</span></code></p></td>
<td><p>Use <code class="docutils literal notranslate"><span class="pre">`UploadFile</span></code> &lt;usage/requests/file-uploads&gt;`__</p></td>
<td><p>Use <code class="docutils literal notranslate"><span class="pre">UploadFile</span></code> see in <a class="reference internal" href="../usage/requests.html"><span class="doc">Requests</span></a></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">request.form</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">request.form()</span></code>, prefer <code class="docutils literal notranslate"><span class="pre">`Body</span></code> &lt;usage/requests/content-type&gt;`__</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">request.form()</span></code>, prefer <code class="docutils literal notranslate"><span class="pre">Body</span></code> see in <a class="reference internal" href="../usage/requests.html"><span class="doc">Requests</span></a></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">request.get_json</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">request.json()</span></code>, prefer the <code class="docutils literal notranslate"><span class="pre">`data</span> <span class="pre">keyword</span> <span class="pre">argument</span></code> &lt;usage/requests/request-body&gt;`__</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">request.json()</span></code>, prefer the <code class="docutils literal notranslate"><span class="pre">data</span></code> keyword argument, see in <a class="reference internal" href="../usage/requests.html"><span class="doc">Requests</span></a></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">request.headers</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">request.headers</span></code></p></td>
Expand Down Expand Up @@ -1851,11 +1851,11 @@ <h2>Static files<a class="headerlink" href="#static-files" title="Permalink to t
will automatically serve files from a <code class="docutils literal notranslate"><span class="pre">static</span></code> folder, this has to be configured explicitly
in Litestar.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">litestar</span> <span class="kn">import</span> <span class="n">Litestar</span>
<span class="kn">from</span> <span class="nn">litestar.static_files</span> <span class="kn">import</span> <span class="n">StaticFilesConfig</span>
<span class="kn">from</span> <span class="nn">litestar.static_files</span> <span class="kn">import</span> <span class="n">create_static_files_router</span>

<span class="n">app</span> <span class="o">=</span> <span class="n">Litestar</span><span class="p">(</span>
<span class="p">[],</span> <span class="n">static_files_config</span><span class="o">=</span><span class="p">[</span><span class="n">StaticFilesConfig</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="s2">&quot;/static&quot;</span><span class="p">,</span> <span class="n">directories</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;static&quot;</span><span class="p">])]</span>
<span class="p">)</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">Litestar</span> <span class="n">route_handlers</span><span class="o">=</span><span class="p">[</span>
<span class="n">create_static_files_router</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="s2">&quot;/static&quot;</span><span class="p">,</span> <span class="n">directories</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;assets&quot;</span><span class="p">]),</span>
<span class="p">])</span>
</pre></div>
</div>
<div class="admonition seealso">
Expand Down Expand Up @@ -2016,7 +2016,7 @@ <h2>Redirects<a class="headerlink" href="#redirects" title="Permalink to this he

<span class="nd">@get</span><span class="p">(</span><span class="s2">&quot;/hello&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">hello</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="n">Redirect</span><span class="p">:</span>
<span class="k">return</span> <span class="n">Redirect</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="s2">&quot;index&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Redirect</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="s2">&quot;/&quot;</span><span class="p">)</span>


<span class="n">app</span> <span class="o">=</span> <span class="n">Litestar</span><span class="p">([</span><span class="n">index</span><span class="p">,</span> <span class="n">hello</span><span class="p">])</span>
Expand Down
4 changes: 2 additions & 2 deletions 3940/reference/app.html

Large diffs are not rendered by default.

Loading

0 comments on commit bd47d48

Please sign in to comment.