File: quickstart.rst

package info (click to toggle)
quart 0.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,888 kB
  • sloc: python: 8,644; makefile: 42; sh: 17; sql: 6
file content (46 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.. _quickstart:

Quickstart
==========

Hello World
-----------

A very simple app that simply returns a response containing ``hello``
is, (file ``hello-world.py``)

.. code-block:: python

    from quart import Quart

    app = Quart(__name__)

    @app.route('/')
    async def hello():
        return 'hello'

    app.run()

and is simply run via

.. code-block:: console

    python hello-world.py

or alternatively

.. code-block:: console

    $ export QUART_APP=hello-world:app
    $ quart run

and tested by

.. code-block:: sh

    curl localhost:5000

See also
--------

:ref:`cheatsheet`