diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/quick_tour.rst | 13 | ||||
| -rw-r--r-- | docs/quick_tour/json/hello_world.jinja2 | 2 | ||||
| -rw-r--r-- | docs/quick_tour/static_assets/hello_world.jinja2 | 2 | ||||
| -rw-r--r-- | docs/quick_tour/static_assets/hello_world_static.jinja2 | 2 |
4 files changed, 10 insertions, 9 deletions
diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index b170e5d98..55557f501 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -339,9 +339,10 @@ Static assets Of course the Web is more than just markup. You need static assets: CSS, JS, and images. Let's point our web app at a directory from which Pyramid will serve some static assets. First let's make another call to the -:term:`configurator`: +:term:`configurator` in ``app.py``: .. literalinclude:: quick_tour/static_assets/app.py + :language: python :linenos: :lines: 6-8 :lineno-start: 6 @@ -359,7 +360,7 @@ Next make a directory named ``static``, and place ``app.css`` inside: All we need to do now is point to it in the ``<head>`` of our Jinja2 template, ``hello_world.jinja2``: -.. literalinclude:: quick_tour/static_assets/hello_world.jinja2 +.. literalinclude:: quick_tour/static_assets/hello_world_static.jinja2 :language: jinja :linenos: :lines: 4-6 @@ -371,16 +372,16 @@ the site is later moved under ``/somesite/static/``? Or perhaps a web developer changes the arrangement on disk? Pyramid provides a helper to allow flexibility on URL generation: -.. literalinclude:: quick_tour/static_assets/hello_world_static.jinja2 +.. literalinclude:: quick_tour/static_assets/hello_world.jinja2 :language: jinja :linenos: :lines: 4-6 :lineno-start: 4 :emphasize-lines: 2 -By using ``request.static_url`` to generate the full URL to the static -assets, you both ensure you stay in sync with the configuration and -gain refactoring flexibility later. +By using ``request.static_url`` to generate the full URL to the static assets, +you ensure that you stay in sync with the configuration and gain refactoring +flexibility later. .. seealso:: See also: :ref:`Quick Tutorial Static Assets <qtut_static_assets>`, diff --git a/docs/quick_tour/json/hello_world.jinja2 b/docs/quick_tour/json/hello_world.jinja2 index 4fb9be074..a55865231 100644 --- a/docs/quick_tour/json/hello_world.jinja2 +++ b/docs/quick_tour/json/hello_world.jinja2 @@ -2,7 +2,7 @@ <html lang="en"> <head> <title>Hello World</title> - <link rel="stylesheet" href="{{ request.static_url('static/app.css') }}"/> + <link rel="stylesheet" href="{{ request.static_url('__main__:static/app.css') }}"/> </head> <body> <h1>Hello {{ name }}!</h1> diff --git a/docs/quick_tour/static_assets/hello_world.jinja2 b/docs/quick_tour/static_assets/hello_world.jinja2 index 0fb2ce296..a55865231 100644 --- a/docs/quick_tour/static_assets/hello_world.jinja2 +++ b/docs/quick_tour/static_assets/hello_world.jinja2 @@ -2,7 +2,7 @@ <html lang="en"> <head> <title>Hello World</title> - <link rel="stylesheet" href="/static/app.css"/> + <link rel="stylesheet" href="{{ request.static_url('__main__:static/app.css') }}"/> </head> <body> <h1>Hello {{ name }}!</h1> diff --git a/docs/quick_tour/static_assets/hello_world_static.jinja2 b/docs/quick_tour/static_assets/hello_world_static.jinja2 index 4fb9be074..0fb2ce296 100644 --- a/docs/quick_tour/static_assets/hello_world_static.jinja2 +++ b/docs/quick_tour/static_assets/hello_world_static.jinja2 @@ -2,7 +2,7 @@ <html lang="en"> <head> <title>Hello World</title> - <link rel="stylesheet" href="{{ request.static_url('static/app.css') }}"/> + <link rel="stylesheet" href="/static/app.css"/> </head> <body> <h1>Hello {{ name }}!</h1> |
