diff options
| author | Paul Everitt <paul@agendaless.com> | 2013-06-11 14:54:58 -0400 |
|---|---|---|
| committer | Paul Everitt <paul@agendaless.com> | 2013-06-11 14:54:58 -0400 |
| commit | 47eaa189e115936a86357380accd8d472e4d9a6c (patch) | |
| tree | 5fecfd689405242e49d442c1dfaf29cd19fdce99 /docs | |
| parent | 5832ca31ecd9bea02f32ff90c56bab52114541da (diff) | |
| download | pyramid-47eaa189e115936a86357380accd8d472e4d9a6c.tar.gz pyramid-47eaa189e115936a86357380accd8d472e4d9a6c.tar.bz2 pyramid-47eaa189e115936a86357380accd8d472e4d9a6c.zip | |
About half of the first pass is done.
Diffstat (limited to 'docs')
49 files changed, 1311 insertions, 0 deletions
diff --git a/docs/getting_started/about_guide.rst b/docs/getting_started/about_guide.rst new file mode 100644 index 000000000..812b07457 --- /dev/null +++ b/docs/getting_started/about_guide.rst @@ -0,0 +1,14 @@ +================ +About This Guide +================ + + +- Chapter titles are meaningful + +- Each chapter is autonomous, no one-big-application here + +- Interlinking + +- Reporting bugs or ideas + +- SO for questions
\ No newline at end of file diff --git a/docs/getting_started/configuration.rst b/docs/getting_started/configuration.rst new file mode 100644 index 000000000..30280c7e1 --- /dev/null +++ b/docs/getting_started/configuration.rst @@ -0,0 +1,4 @@ +============================================ +Managing Project Settings With Configuration +============================================ + diff --git a/docs/getting_started/databases.rst b/docs/getting_started/databases.rst new file mode 100644 index 000000000..f982643af --- /dev/null +++ b/docs/getting_started/databases.rst @@ -0,0 +1,4 @@ +========================= +Databases With SQLAlchemy +========================= + diff --git a/docs/getting_started/forms.rst b/docs/getting_started/forms.rst new file mode 100644 index 000000000..039bfbce4 --- /dev/null +++ b/docs/getting_started/forms.rst @@ -0,0 +1,3 @@ +================================ +Forms and Validation With Deform +================================ diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst new file mode 100644 index 000000000..6396a8e6c --- /dev/null +++ b/docs/getting_started/index.rst @@ -0,0 +1,104 @@ +============================ +Getting Started With Pyramid +============================ + +Welcome to Pyramid, the Python web framework that lets you start small +and finish big. Whether you are new to Python web development or you're +an experienced developer that wants a quick look at the major +features, this guide provides a convenient entry point with independent +chapters for each topic. + +:doc:`quick_glance` +=================== + +Python web development is a very big topic. Wouldn't it be great to +have a quick overview, end-to-end, just to get oriented? This chapter +shows "a little about a lot", full of short code snippets and links to +deeper treatment of topics. Additionally, we showcase some facilities +that make Pyramid unique for "applications with ambition." + +:doc:`about_guide` +================== + +Now that we have set the scene, we explain the purpose of this guide +(and non-purpose), showing how it is organized. + + +:doc:`scaffolds` +================ + +Pyramid projects are organized using normal Python facilities for +projects. Normal, though, is in the eye of the beholder. This chapter +shows how to use scaffolds to automate the boilerplate and quickly +start development of a new project. + +Topics: scaffolds, packaging, virtual environments + +:doc:`configuration` +==================== + + +:doc:`routes` +============= + +:doc:`views` +============ + +:doc:`templates` +================ + +:doc:`static_assets` +==================== + +:doc:`testing` +============== + +:doc:`forms` +============ + +:doc:`databases` +================ + +:doc:`security` +=============== + +:doc:`json` +=========== + + +:doc:`sessions` +=============== + +:doc:`internationalization` +=========================== + + +:doc:`special_views` +==================== + +:doc:`top_ten` +============== + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + quick_glance + about_guide + scaffolds + configuration + routes + views + templates + static_assets + testing + forms + databases + security + json + sessions + internationalization + special_views + top_ten
\ No newline at end of file diff --git a/docs/getting_started/internationalization.rst b/docs/getting_started/internationalization.rst new file mode 100644 index 000000000..cc93406b1 --- /dev/null +++ b/docs/getting_started/internationalization.rst @@ -0,0 +1,3 @@ +============================================= +Multiple Languages Using Internationalization +============================================= diff --git a/docs/getting_started/json.rst b/docs/getting_started/json.rst new file mode 100644 index 000000000..006b44fc3 --- /dev/null +++ b/docs/getting_started/json.rst @@ -0,0 +1,4 @@ +================================= +Modern Web Development Using JSON +================================= + diff --git a/docs/getting_started/quick_glance.rst b/docs/getting_started/quick_glance.rst new file mode 100644 index 000000000..13ae22ba5 --- /dev/null +++ b/docs/getting_started/quick_glance.rst @@ -0,0 +1,539 @@ +============ +Quick Glance +============ + +Pyramid lets you start small and finish big. The +:doc:`index` guide +walks you through many of the key features. Let's put the emphasis on +*start* by doing a quick tour through Pyramid. + +This *Quick Glance* is shorthand, snippet-oriented. It is not intended +as full example. Instead, the other chapters will provide complete +examples. + +.. note:: + + Like the rest of Getting Started, we're using Python 3 in + our samples. You can too, or you can use Python 2.7. + +The Smallest +============ + +Microframeworks have shown that learning starts best from a very small +first step. Here's a tiny application in Pyramid: + +.. literalinclude:: quick_glance/app1.py + +This simple example is easy to run. Save this as ``app.py`` and run it: + +.. code-block:: bash + + $ python3 ./app.py + +Finally, open `http://localhost:8081/ <http://localhost:8081/>`_ in a +browser and you will see the ``Hello World!`` message. + +At a high level, we wrote a Python module, which when executed, +started an HTTP server. This HTTP server ran a WSGI application with +one "view". This view handled the ``http://localhost:8081/`` URL. + +More specifically: + +#. We imported an HTTP server (``make_server``), a configuration system + (``Configurator``), and a way to send HTTP responses (``Response``). + +#. We made a ``hello_world`` function that returned a ``Response``. + +#. Our ``main`` function started the configuration, added a "route", + and then mapped that route to a "view". + +#. To finish, we then made a WSGI app and served it. + ``if __name__ == '__main__':`` is a standard Python technique to + execute code when it is run from the command line instead of + imported into another module. + +.. note:: + + The configuration of the route and the view are split. Other systems + let you bundle those together. Pyramid makes you do the extra step, + but for a reason: this lets you control the ordering. More on this + later. + +Using Decorators and Matchdicts +=============================== + +Let's repeat the smallest step, but make it a little more functional +and elegant by adding: + +- Echo back a name sent in via the URL + +- The URL is below the top of the site + +- Use a decorator to register the view + +Let's make update our ``app.py`` module: + +.. literalinclude:: quick_glance/app2.py + :linenos: + +When you run ``python3 ./app.py`` and visit a URL such as +``http://localhost:8081/hello/amy``, the response includes ``amy`` in +the HTML. + +This module, while small, starts to show how many Pyramid applications +are composed: + +#. We use a decorator around the view, to put the configuration closer + to the code. + +#. We tell the ``Configurator`` to go look for decorators. + +Templates +========= + +You usually won't embed an HTML string directly in Python, but instead, +will use a templating language. Pyramid comes bundled with Chameleon +and Mako, but Jinja2 is popular. Let's install it: + +.. code-block:: bash + + $ pip install pyramid_jinja2 + +With the package installed, we can include the template bindings into +our configuration: + +.. code-block:: python + + config.include('pyramid_jinja2') + +Our view changes. We only return Python data and let the ``renderer`` +argument tell Pyramid to pass the response through Jinja2: + +.. code-block:: python + + @view_config(route_name='hello', renderer="app3.jinja2") + def hello_world(request): + return dict(name=request.matchdict['name']) + +Our template is HTML-oriented with a little logic in the ``<h1>``: + +.. code-block:: html + + <html lang="en"> + <html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>Quick Glance</title> + </head> + <body> + <h1>Hello {{ name }}!</h1> + </body> + </html> + +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 where +Pyramid will serve some static assets. First, another call to the +``Configurator``: + +.. code-block:: python + + config.add_static_view(name='static', path='static') + +This tells our WSGI application to map requests under +``http://localhost:8081/static/`` to files and directories inside a +``static`` directory alongside our Python module. + +Next, make a directory ``static`` and place ``app.css`` inside: + +.. code-block:: css + + body { + margin: 2em; + font-family: sans-serif; + } + +All we need to do now is point to it in the ``<head>`` of our Jinja2 +template: + +.. code-block:: html + + <link rel="stylesheet" href="/static/app.css" /> + +Returning JSON +============== + +Modern web apps are more than rendered HTML. Dynamic pages now use +JavaScript update the UI in the browser by requesting server data as +JSON. + +Pyramid supports this with a JSON renderer: + +.. code-block:: python + + @view_config(route_name='hello_json', renderer='json') + def hello_json(request): + return [1, 2, 3] + +This wires up a view that returns some data through the JSON +"renderer", which calls Python's JSON support to serialize the data +into JSON, set the appropriate HTTP headers, and more. + +The view needs a route added to the ``Configurator``: + +.. code-block:: python + + config.add_route('hello_json', 'hello.json') + + +View Classes +============ + +Free-standing functions are the regular way to do views. Many times, +though, you have several views that are closely related. For example, +a document might have many different ways to look at it. + +For some people, grouping these together makes logical sense. A view +class lets you group views, sharing some state assignments, and +using helper functions as class methods. + +Let's re-organize our two views into methods on a view class: + +.. code-block:: python + + class HelloWorldViews: + def __init__(self, request): + self.request = request + + @view_config(route_name='hello', renderer='app4.jinja2') + def hello_world(self): + return dict(name=self.request.matchdict['name']) + + + @view_config(route_name='hello_json', renderer='json') + def hello_json(self): + return [1, 2, 3] + +Everything else remains the same. + +Quick Project Startup with Scaffolds +==================================== + +So far we have done all of our *Quick Glance* as a single Python file. +No Python packages, no structure. Most Pyramid projects, though, +aren't developed this way. + +To ease the process of getting started, Pyramid provides *scaffolds* +that generate sample projects. Not just Pyramid itself: add-ons such as +``pyramid_jinja2`` (or your own projects) can register there own +scaffolds. + +We use Pyramid's ``pcreate`` command to generate our starting point +from a scaffold. What does this command look like? + +.. code-block:: bash + + $ pcreate --help + Usage: pcreate [options] output_directory + + Render Pyramid scaffolding to an output directory + + Options: + -h, --help show this help message and exit + -s SCAFFOLD_NAME, --scaffold=SCAFFOLD_NAME + Add a scaffold to the create process (multiple -s args + accepted) + -t SCAFFOLD_NAME, --template=SCAFFOLD_NAME + A backwards compatibility alias for -s/--scaffold. + Add a scaffold to the create process (multiple -t args + accepted) + -l, --list List all available scaffold names + --list-templates A backwards compatibility alias for -l/--list. List + all available scaffold names. + --simulate Simulate but do no work + --overwrite Always overwrite + --interactive When a file would be overwritten, interrogate + +Let's see what our Pyramid install supports as starting-point scaffolds: + +.. code-block:: bash + + $ pcreate --list + Available scaffolds: + alchemy: Pyramid SQLAlchemy project using url dispatch + pyramid_jinja2_starter: pyramid jinja2 starter project + starter: Pyramid starter project + zodb: Pyramid ZODB project using traversal + +The ``pyramid_jinja2_starter`` looks interesting. From the parent +directory of where we want our Python package to be generated, +let's use that scaffold to make our project: + +.. code-block:: bash + + $ pcreate --scaffold pyramid_jinja2_starter hello_world + +After printing a bunch of lines about the files being generated, +we now have a Python package. As described in the *official +instructions*, we need to install this as a development package: + +.. code-block:: bash + + $ cd hello_world + $ python3.3 ./setup.py develop + +What did we get? A top-level directory ``hello_world`` that includes +some packaging files and a subdirectory ``hello_world`` that has +sample files for our application: + +.. code-block:: bash + + $ ls + CHANGES.txt development.ini hello_world.egg-info + MANIFEST.in message-extraction.ini setup.cfg + README.txt hello_world setup.py + + $ ls hello_world + __init__.py locale static tests.py + __pycache__ models.py templates views.py + +We are moving in the direction of a full-featured Pyramid project, +with a proper setup for Python standards (packaging) and Pyramid +configuration. This includes a new way of running your application: + +.. code-block:: bash + + $ pserve development.ini + +With ``pserve``, your application isn't responsible for finding a WSGI +server and launching your WSGI app. Also, much of the wiring of your +application can be moved to a declarative ``.ini`` configuration file. + +In your browser, visit +`http://localhost:6543/ <http://localhost:6543/>`_ and you'll see that +things look very different. In the next few sections we'll cover some +decisions made by this scaffold. + +Let's look at ``pserve`` and configuration in more depth. + +Application Running with ``pserve`` +=================================== + +When you install Pyramid, a small command program called ``pserve`` is +written to your ``bin`` directory. This program is an executable Python +module. It's very small, getting most of its brains via import. + +You can run ``pserve`` with ``--help`` to see some of its options. +Doing so reveals that you can ask ``pserve`` to watch your development +files and reload the server when they change: + +.. code-block:: bash + + $ pserve development.ini --reload + +By design, ``pserve`` itself isn't all that interesting. Instead, +its brains from your project's wiring, as expressed in the +configuration file you supply it. + +.. seealso:: See Also: :ref:`what_is_this_pserve_thing` + +Three Cool Things About ``pserve`` +---------------------------------- + +1. *Multiple .ini files*. You might have some settings in + development mode or some in production mode. Maybe you are writing an + add-on that needs to be wired-up by other people. + +2. *Choice of WSGI server*. ``pserve`` itself isn't a WSGI server. + Instead, it loads the server you want from the configuration file. + +3. *Friends of pserve*. With the ``pserve``/``.ini`` approach you + also get other commands that help during development: ``pshell``, + ``proutes``, ``pviews``, ``prequest``, etc. + +Configuration with ``.ini`` Files +================================= + +Earlier in *Quick Glance* we first met Pyramid's configuration system. +At that point we did all configuration in Python code, +aka *imperatively*. For example, the port number chosen for our HTTP +server was right there in Python code. Our scaffold has moved this +decision, and more, into *declarative* configuration in the +``development.ini`` file. + +Let's take a quick high-level look. First, the ``.ini`` file is divided +into sections: + +- ``[app:hello_world]`` configures our WSGI app + +- ``[pipeline:main]`` sets up our WSGI "pipeline" + +- ``[server:main]`` holds our WSGI server settings + +- Various sections afterwards configure our Python logging system + +Let's look at a few decisions made in this configuration: + +#. *Choice of web server*. The ``use = egg:pyramid#wsgiref`` tell + ``pserve`` to the ``wsgiref`` server that is wrapped in the Pyramid + package. + +#. *Port number*. ``port = 6543`` tells ``wsgiref`` to listen on port + 6543. + +#. *WSGI app*. What package has our WSGI application in it? + ``use = egg:hello_world`` in the app section tells the + configuration what application to load. + +#. *Easier development by automatic template reloading*. In development + mode, you shouldn't have to restart the server when editing a Jinja2 + template. ``reload_templates = true`` sets this policy, + which might be different in production. + +Additionally, the ``development.ini`` generated by this scaffold wired +up Python's standard logging. We'll now see in the console, for example, +a log on every request that comes in, as well traceback information. + +Easier Development with ``debugtoolbar`` +======================================== + +As we introduce the basics we also want to show how to be productive in +development and debugging. For example, we just discussed template +reloading and earlier we showed ``--reload`` for application reloading. + +``pyramid_debugtoolbar`` is a popular Pyramid add-on which makes +several tools available in your browser. Adding it to your project +illustrates several points about configuration. + +First, change your ``setup.py`` to say: + +.. code-block:: python + + requires=['pyramid>=1.0.2', 'pyramid_jinja2'] + +...and re-run your setup: + +.. code-block:: bash + + $ python3.3 ./setup.py develop + +The Python package was now installed into our environment but we +haven't told our web app to use it. We can do so imperatively in code: + +.. code-block:: python + + config.include('pyramid_debugtoolbar') + +Instead, let's do it in configuration by modifying our +``development.ini`` instead: + +.. code-block:: ini + + [app:hello_world] + pyramid.includes = pyramid_debugtoolbar + +That is, add ``pyramid.includes = pyramid_debugtoolbar`` anywhere in the +``[app:hello_world]`` section. You'll now see an attractive (and +collapsible) menu in the right of your browser giving you introspective +access to debugging information. Even better, if your web application +generates an error, you will see a nice traceback on the screen. + +Unit Tests and ``nose`` +======================= + +Yikes! We got this far and we haven't yet discussed tests. Particularly +egregious, as Pyramid has had a deep commitment to full test coverage +since before it was released. + +Our ``pyramid_jinja2_starter`` scaffold generated a ``tests.py`` module +with one unit test in it. To run it, let's install the handy ``nose`` +test runner by editing ``setup.py``. While we're at it, we'll throw in +the ``coverage`` tool which yells at us for code that isn't tested: + +.. code-block:: python + + setup(name='hello_world', + # Some lines removed... + extras_require={ + 'testing': ['nose', 'coverage'], + } + ) + +We changed ``setup.py`` which means we need to re-run +``python3.3 ./setup.py develop``. We can now run all our tests: + +.. code-block:: bash + + $ nosetests + . + Name Stmts Miss Cover Missing + --------------------------------------------------- + hello_world 12 8 33% 11-23 + hello_world.models 5 1 80% 8 + hello_world.tests 14 0 100% + hello_world.views 4 0 100% + --------------------------------------------------- + TOTAL 35 9 74% + ---------------------------------------------------------------------- + Ran 1 test in 0.931s + + OK + +Our unit test passed. What did our test look like? + +.. code-block:: python + + import unittest + from pyramid import testing + + + class ViewTests(unittest.TestCase): + def setUp(self): + testing.setUp() + + def tearDown(self): + testing.tearDown() + + def test_my_view(self): + from hello_world.views import my_view + + request = testing.DummyRequest() + response = my_view(request) + self.assertEqual(response['project'], 'hello_world') + +Pyramid supplies helpers for test writing, which we use in the +test setup and teardown. Our one test imports the view, +makes a dummy request, and sees if the view returns what we expected. + + + + - logging + + - resources, asset specs, tests, + +sessions, logging, special views +databases, forms, security + +Notes + +- Change 8081 -> 6543 + +- See also, interlinking, teasers or "3 Extras" at the end of each + section, links to a downloadable version of the Python module + +- Read "pyramid for humans" and getting started as an attempt to kill + those + +- Do a better job at the "why" + +- Explain imperative vs. declarative configuration and link to "why + configuration" + +- For see also, point also to Getting Started sections + +- Debugging + +- Template reloading + +- Explain and link to WSGI, Python Packages
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app1.py b/docs/getting_started/quick_glance/app1.py new file mode 100644 index 000000000..cffe53ecf --- /dev/null +++ b/docs/getting_started/quick_glance/app1.py @@ -0,0 +1,16 @@ +from wsgiref.simple_server import make_server +from pyramid.config import Configurator +from pyramid.response import Response + + +def hello_world(request): + return Response('<h1>Hello World!</h1>') + + +if __name__ == '__main__': + config = Configurator() + config.add_route('hello', '/') + config.add_view(hello_world, route_name='hello') + app = config.make_wsgi_app() + server = make_server('0.0.0.0', 8081, app) + server.serve_forever()
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app2.py b/docs/getting_started/quick_glance/app2.py new file mode 100644 index 000000000..49ccd3be1 --- /dev/null +++ b/docs/getting_started/quick_glance/app2.py @@ -0,0 +1,18 @@ +from wsgiref.simple_server import make_server +from pyramid.config import Configurator +from pyramid.response import Response +from pyramid.view import view_config + + +@view_config(route_name='hello') +def hello_world(request): + return Response('<h1>Hello %(name)s!</h1>' % request.matchdict) + + +if __name__ == '__main__': + config = Configurator() + config.add_route('hello', '/hello/{name}') + config.scan() + app = config.make_wsgi_app() + server = make_server('0.0.0.0', 8081, app) + server.serve_forever()
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app3.jinja2 b/docs/getting_started/quick_glance/app3.jinja2 new file mode 100644 index 000000000..6d9f0cd5f --- /dev/null +++ b/docs/getting_started/quick_glance/app3.jinja2 @@ -0,0 +1,9 @@ +<html lang="en"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>Quick Glance</title> +</head> +<body> +<h1>Hello {{ name }}!</h1> +</body> +</html>
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app3.py b/docs/getting_started/quick_glance/app3.py new file mode 100644 index 000000000..549cb5f54 --- /dev/null +++ b/docs/getting_started/quick_glance/app3.py @@ -0,0 +1,19 @@ +from wsgiref.simple_server import make_server +from pyramid.config import Configurator +from pyramid.response import Response +from pyramid.view import view_config + + +@view_config(route_name='hello', renderer='app3.jinja2') +def hello_world(request): + return dict(name=request.matchdict['name']) + + +if __name__ == '__main__': + config = Configurator() + config.add_route('hello', '/hello/{name}') + config.include('pyramid_jinja2') + config.scan() + app = config.make_wsgi_app() + server = make_server('0.0.0.0', 8081, app) + server.serve_forever()
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app4.jinja2 b/docs/getting_started/quick_glance/app4.jinja2 new file mode 100644 index 000000000..3d0f28c1f --- /dev/null +++ b/docs/getting_started/quick_glance/app4.jinja2 @@ -0,0 +1,10 @@ +<html lang="en"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>Quick Glance</title> + <link rel="stylesheet" href="/static/app.css" /> +</head> +<body> +<h1>Hello {{ name }}!</h1> +</body> +</html>
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app4.py b/docs/getting_started/quick_glance/app4.py new file mode 100644 index 000000000..245ed0b68 --- /dev/null +++ b/docs/getting_started/quick_glance/app4.py @@ -0,0 +1,19 @@ +from wsgiref.simple_server import make_server +from pyramid.config import Configurator +from pyramid.view import view_config + + +@view_config(route_name='hello', renderer='app4.jinja2') +def hello_world(request): + return dict(name=request.matchdict['name']) + + +if __name__ == '__main__': + config = Configurator() + config.add_route('hello', '/hello/{name}') + config.add_static_view(name='static', path='static') + config.include('pyramid_jinja2') + config.scan() + app = config.make_wsgi_app() + server = make_server('0.0.0.0', 8081, app) + server.serve_forever()
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app5.py b/docs/getting_started/quick_glance/app5.py new file mode 100644 index 000000000..245a0a5ae --- /dev/null +++ b/docs/getting_started/quick_glance/app5.py @@ -0,0 +1,26 @@ +from wsgiref.simple_server import make_server + +from pyramid.config import Configurator +from pyramid.view import view_config + + +@view_config(route_name='hello', renderer='app4.jinja2') +def hello_world(request): + return dict(name=request.matchdict['name']) + + +@view_config(route_name='hello_json', renderer='json') +def hello_json(request): + return [1, 2, 3] + + +if __name__ == '__main__': + config = Configurator() + config.add_route('hello', '/hello/{name}') + config.add_route('hello_json', 'hello.json') + config.add_static_view(name='static', path='static') + config.include('pyramid_jinja2') + config.scan() + app = config.make_wsgi_app() + server = make_server('0.0.0.0', 8081, app) + server.serve_forever()
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/app6.py b/docs/getting_started/quick_glance/app6.py new file mode 100644 index 000000000..155becc54 --- /dev/null +++ b/docs/getting_started/quick_glance/app6.py @@ -0,0 +1,30 @@ +from wsgiref.simple_server import make_server + +from pyramid.config import Configurator +from pyramid.view import view_config + + +class HelloWorldViews: + def __init__(self, request): + self.request = request + + @view_config(route_name='hello', renderer='app4.jinja2') + def hello_world(self): + return dict(name=self.request.matchdict['name']) + + + @view_config(route_name='hello_json', renderer='json') + def hello_json(self): + return [1, 2, 3] + + +if __name__ == '__main__': + config = Configurator() + config.add_route('hello', '/hello/{name}') + config.add_route('hello_json', 'hello.json') + config.add_static_view(name='static', path='static') + config.include('pyramid_jinja2') + config.scan() + app = config.make_wsgi_app() + server = make_server('0.0.0.0', 8081, app) + server.serve_forever()
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/hello_world/CHANGES.txt b/docs/getting_started/quick_glance/hello_world/CHANGES.txt new file mode 100644 index 000000000..ffa255da8 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/CHANGES.txt @@ -0,0 +1,4 @@ +0.0 +--- + +- Initial version diff --git a/docs/getting_started/quick_glance/hello_world/MANIFEST.in b/docs/getting_started/quick_glance/hello_world/MANIFEST.in new file mode 100644 index 000000000..18fbd855c --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/MANIFEST.in @@ -0,0 +1,2 @@ +include *.txt *.ini *.cfg *.rst +recursive-include hello_world *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml diff --git a/docs/getting_started/quick_glance/hello_world/README.txt b/docs/getting_started/quick_glance/hello_world/README.txt new file mode 100644 index 000000000..63aaf6fbd --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/README.txt @@ -0,0 +1,4 @@ +hello_world README + + + diff --git a/docs/getting_started/quick_glance/hello_world/development.ini b/docs/getting_started/quick_glance/hello_world/development.ini new file mode 100644 index 000000000..9aa5f40cf --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/development.ini @@ -0,0 +1,52 @@ +[app:hello_world] +pyramid.includes = pyramid_debugtoolbar +use = egg:hello_world +reload_templates = true +debug_authorization = false +debug_notfound = false +debug_routematch = false +debug_templates = true +default_locale_name = en +jinja2.directories = hello_world:templates + + + +[pipeline:main] +pipeline = + hello_world + +[server:main] +use = egg:pyramid#wsgiref +host = 0.0.0.0 +port = 6543 + +# Begin logging configuration + +[loggers] +keys = root, hello_world + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = INFO +handlers = console + +[logger_hello_world] +level = DEBUG +handlers = +qualname = hello_world + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s + +# End logging configuration diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/__init__.py b/docs/getting_started/quick_glance/hello_world/hello_world/__init__.py new file mode 100644 index 000000000..9b5753c26 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/__init__.py @@ -0,0 +1,23 @@ +from pyramid.config import Configurator +from pyramid_jinja2 import renderer_factory +from hello_world.models import get_root + +def main(global_config, **settings): + """ This function returns a WSGI application. + + It is usually called by the PasteDeploy framework during + ``paster serve``. + """ + settings = dict(settings) + settings.setdefault('jinja2.i18n.domain', 'hello_world') + + config = Configurator(root_factory=get_root, settings=settings) + config.add_translation_dirs('locale/') + config.include('pyramid_jinja2') + + config.add_static_view('static', 'static') + config.add_view('hello_world.views.my_view', + context='hello_world.models.MyModel', + renderer="mytemplate.jinja2") + + return config.make_wsgi_app() diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/locale/de/LC_MESSAGES/hello_world.mo b/docs/getting_started/quick_glance/hello_world/hello_world/locale/de/LC_MESSAGES/hello_world.mo Binary files differnew file mode 100644 index 000000000..40bf0c271 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/locale/de/LC_MESSAGES/hello_world.mo diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/locale/de/LC_MESSAGES/hello_world.po b/docs/getting_started/quick_glance/hello_world/hello_world/locale/de/LC_MESSAGES/hello_world.po new file mode 100644 index 000000000..0df243dba --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/locale/de/LC_MESSAGES/hello_world.po @@ -0,0 +1,21 @@ +# Translations template for PROJECT. +# Copyright (C) 2011 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2011-05-12 09:14-0330\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" + +msgid "Hello!" +msgstr "Hallo!" diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/locale/fr/LC_MESSAGES/hello_world.mo b/docs/getting_started/quick_glance/hello_world/hello_world/locale/fr/LC_MESSAGES/hello_world.mo Binary files differnew file mode 100644 index 000000000..4fc438bfe --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/locale/fr/LC_MESSAGES/hello_world.mo diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/locale/fr/LC_MESSAGES/hello_world.po b/docs/getting_started/quick_glance/hello_world/hello_world/locale/fr/LC_MESSAGES/hello_world.po new file mode 100644 index 000000000..dc0aae5d7 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/locale/fr/LC_MESSAGES/hello_world.po @@ -0,0 +1,21 @@ +# Translations template for PROJECT. +# Copyright (C) 2011 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2011-05-12 09:14-0330\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" + +msgid "Hello!" +msgstr "Bonjour!" diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/locale/hello_world.pot b/docs/getting_started/quick_glance/hello_world/hello_world/locale/hello_world.pot new file mode 100644 index 000000000..9c9460cb2 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/locale/hello_world.pot @@ -0,0 +1,21 @@ +# Translations template for PROJECT. +# Copyright (C) 2011 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2011-05-12 09:14-0330\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" + +msgid "Hello!" +msgstr "" diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/models.py b/docs/getting_started/quick_glance/hello_world/hello_world/models.py new file mode 100644 index 000000000..edd361c9c --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/models.py @@ -0,0 +1,8 @@ +class MyModel(object): + pass + +root = MyModel() + + +def get_root(request): + return root diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/static/favicon.ico b/docs/getting_started/quick_glance/hello_world/hello_world/static/favicon.ico Binary files differnew file mode 100644 index 000000000..71f837c9e --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/static/favicon.ico diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/static/logo.png b/docs/getting_started/quick_glance/hello_world/hello_world/static/logo.png Binary files differnew file mode 100644 index 000000000..88f5d9865 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/static/logo.png diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/static/pylons.css b/docs/getting_started/quick_glance/hello_world/hello_world/static/pylons.css new file mode 100644 index 000000000..42e2e320e --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/static/pylons.css @@ -0,0 +1,73 @@ +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;/* 16px */ +vertical-align:baseline;background:transparent;} +body{line-height:1;} +ol,ul{list-style:none;} +blockquote,q{quotes:none;} +blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;} +/* remember to define focus styles! */ +:focus{outline:0;} +/* remember to highlight inserts somehow! */ +ins{text-decoration:none;} +del{text-decoration:line-through;} +/* tables still need 'cellspacing="0"' in the markup */ +table{border-collapse:collapse;border-spacing:0;} +/* restyling */ +sub{vertical-align:sub;font-size:smaller;line-height:normal;} +sup{vertical-align:super;font-size:smaller;line-height:normal;} +/* lists */ +ul,menu,dir{display:block;list-style-type:disc;margin:1em 0;padding-left:40px;} +ol{display:block;list-style-type:decimal-leading-zero;margin:1em 0;padding-left:40px;} +li{display:list-item;} +/* nested lists have no top/bottom margins */ +ul ul,ul ol,ul dir,ul menu,ul dl,ol ul,ol ol,ol dir,ol menu,ol dl,dir ul,dir ol,dir dir,dir menu,dir dl,menu ul,menu ol,menu dir,menu menu,menu dl,dl ul,dl ol,dl dir,dl menu,dl dl{margin-top:0;margin-bottom:0;} +/* 2 deep unordered lists use a circle */ +ol ul,ul ul,menu ul,dir ul,ol menu,ul menu,menu menu,dir menu,ol dir,ul dir,menu dir,dir dir{list-style-type:circle;} +/* 3 deep (or more) unordered lists use a square */ +ol ol ul,ol ul ul,ol menu ul,ol dir ul,ol ol menu,ol ul menu,ol menu menu,ol dir menu,ol ol dir,ol ul dir,ol menu dir,ol dir dir,ul ol ul,ul ul ul,ul menu ul,ul dir ul,ul ol menu,ul ul menu,ul menu menu,ul dir menu,ul ol dir,ul ul dir,ul menu dir,ul dir dir,menu ol ul,menu ul ul,menu menu ul,menu dir ul,menu ol menu,menu ul menu,menu menu menu,menu dir menu,menu ol dir,menu ul dir,menu menu dir,menu dir dir,dir ol ul,dir ul ul,dir menu ul,dir dir ul,dir ol menu,dir ul menu,dir menu menu,dir dir menu,dir ol dir,dir ul dir,dir menu dir,dir dir dir{list-style-type:square;} +.hidden{display:none;} +p{line-height:1.5em;} +h1{font-size:1.75em;/* 28px */ +line-height:1.7em;font-family:helvetica,verdana;} +h2{font-size:1.5em;/* 24px */ +line-height:1.7em;font-family:helvetica,verdana;} +h3{font-size:1.25em;/* 20px */ +line-height:1.7em;font-family:helvetica,verdana;} +h4{font-size:1em;line-height:1.7em;font-family:helvetica,verdana;} +html,body{width:100%;height:100%;} +body{margin:0;padding:0;background-color:#ffffff;position:relative;font:16px/24px "Nobile","Lucida Grande",Lucida,Verdana,sans-serif;} +a{color:#1b61d6;text-decoration:none;} +a:hover{color:#e88f00;text-decoration:underline;} +body h1, +body h2, +body h3, +body h4, +body h5, +body h6{font-family:"Nobile","Lucida Grande",Lucida,Verdana,sans-serif;font-weight:normal;color:#144fb2;font-style:normal;} +#wrap {min-height: 100%;} +#header,#footer{width:100%;color:#ffffff;height:40px;position:absolute;text-align:center;line-height:40px;overflow:hidden;font-size:12px;} +#header{background-color:#e88f00;top:0;font-size:14px;} +#footer{background-color:#000000;bottom:0;position: relative;margin-top:-40px;clear:both;} +.header,.footer{width:700px;margin-right:auto;margin-left:auto;} +.wrapper{width:100%} +#top,#bottom{width:100%;} +#top{color:#888;background-color:#eee;height:300px;border-bottom:2px solid #ddd;} +#bottom{color:#222;background-color:#ffffff;overflow:auto;padding-bottom:80px;} +.top,.bottom{width:700px;margin-right:auto;margin-left:auto;} +.top{padding-top:100px;} +.app-welcome{margin-top:25px;} +.app-name{color:#000000;font-weight:bold;} +.bottom{padding-top:50px;} +#left{width:325px;float:left;padding-right:25px;} +#right{width:325px;float:right;padding-left:25px;} +.align-left{text-align:left;} +.align-right{text-align:right;} +.align-center{text-align:center;} +ul.links{margin:0;padding:0;} +ul.links li{list-style-type:none;font-size:14px;} +form{border-style:none;} +fieldset{border-style:none;} +input{color:#222;border:1px solid #ccc;font-family:sans-serif;font-size:12px;line-height:16px;} +input[type=text]{} +input[type=submit]{background-color:#ddd;font-weight:bold;} +/*Opera Fix*/ +body:before {content:"";height:100%;float:left;width:0;margin-top:-32767px;} diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/templates/mytemplate.jinja2 b/docs/getting_started/quick_glance/hello_world/hello_world/templates/mytemplate.jinja2 new file mode 100644 index 000000000..a796c7273 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/templates/mytemplate.jinja2 @@ -0,0 +1,87 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>The Pyramid Web Application Development Framework</title> + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> + <meta name="keywords" content="python web application" /> + <meta name="description" content="pyramid web application" /> + <link rel="shortcut icon" href="{{request.application_url}}/static/favicon.ico" /> + <link rel="stylesheet" href="{{request.application_url}}/static/pylons.css" type="text/css" media="screen" charset="utf-8" /> + <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&subset=latin" type="text/css" media="screen" charset="utf-8" /> + <!--[if !IE 7]> + <style type="text/css"> + #wrap {display:table;height:100%} + </style> + <![endif]--> + <style type="text/css"> + .locale { text-align: center; } + .locale-name { font-weight: bold; } + </style> +</head> +<body> + <div id="wrap"> + <div id="header"> + <div class="header">The Pyramid Web Application Development Framework</div> + </div> + <div id="top"> + <div class="top align-center"> + <img src="{{request.application_url}}/static/logo.png" width="300" height="80" alt="Logo"/> + <p class="app-welcome"> + Welcome to <span class="app-name">{{project}}</span>, an application generated by<br/> + the Pyramid web application development framework. + </p> + </div> + </div> + <div id="bottom"> + <div class="locale"> + <h2>{% trans %}Hello!{% endtrans %}</h2> + <p>Request performed with <span class="locale-name">{{ request.locale_name }}</span> locale.</p> + </div> + <div class="bottom"> + <div id="left" class="align-right"> + <h3>Search Pyramid documentation</h3> + <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html"> + <input type="text" id="q" name="q" value="" /> + <input type="submit" id="x" value="Search" /> + </form> + </div> + <div id="right" class="align-left"> + <h3>Pyramid links</h3> + <ul class="links"> + <li> + <a href="http://pylonshq.com">Pylons Website</a> + </li> + <li> + <a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a> + </li> + <li> + <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a> + </li> + <li> + <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a> + </li> + <li> + <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a> + </li> + <li> + <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a> + </li> + <li> + <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a> + </li> + <li> + <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a> + </li> + <li> + <a href="irc://irc.freenode.net#pyramid">IRC Channel</a> + </li> + </ul> + </div> + </div> + </div> + </div> + <div id="footer"> + <div class="footer">© Copyright 2008-2010, Agendaless Consulting.</div> + </div> +</body> +</html> diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/tests.py b/docs/getting_started/quick_glance/hello_world/hello_world/tests.py new file mode 100644 index 000000000..a81c29eb0 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/tests.py @@ -0,0 +1,21 @@ +import unittest +from pyramid import testing +from pyramid.i18n import TranslationStringFactory + +_ = TranslationStringFactory('hello_world') + + +class ViewTests(unittest.TestCase): + + def setUp(self): + testing.setUp() + + def tearDown(self): + testing.tearDown() + + def test_my_view(self): + from hello_world.views import my_view + request = testing.DummyRequest() + response = my_view(request) + self.assertEqual(response['project'], 'hello_world') + diff --git a/docs/getting_started/quick_glance/hello_world/hello_world/views.py b/docs/getting_started/quick_glance/hello_world/hello_world/views.py new file mode 100644 index 000000000..c271d45dd --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/hello_world/views.py @@ -0,0 +1,6 @@ +from pyramid.i18n import TranslationStringFactory + +_ = TranslationStringFactory('hello_world') + +def my_view(request): + return {'project':'hello_world'} diff --git a/docs/getting_started/quick_glance/hello_world/message-extraction.ini b/docs/getting_started/quick_glance/hello_world/message-extraction.ini new file mode 100644 index 000000000..0c3d54bc1 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/message-extraction.ini @@ -0,0 +1,3 @@ +[python: **.py] +[jinja2: **.jinja2] +encoding = utf-8 diff --git a/docs/getting_started/quick_glance/hello_world/setup.cfg b/docs/getting_started/quick_glance/hello_world/setup.cfg new file mode 100644 index 000000000..186e796fc --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/setup.cfg @@ -0,0 +1,28 @@ +[nosetests] +match = ^test +nocapture = 1 +cover-package = hello_world +with-coverage = 1 +cover-erase = 1 + +[compile_catalog] +directory = hello_world/locale +domain = hello_world +statistics = true + +[extract_messages] +add_comments = TRANSLATORS: +output_file = hello_world/locale/hello_world.pot +width = 80 +mapping_file = message-extraction.ini + +[init_catalog] +domain = hello_world +input_file = hello_world/locale/hello_world.pot +output_dir = hello_world/locale + +[update_catalog] +domain = hello_world +input_file = hello_world/locale/hello_world.pot +output_dir = hello_world/locale +previous = true diff --git a/docs/getting_started/quick_glance/hello_world/setup.py b/docs/getting_started/quick_glance/hello_world/setup.py new file mode 100644 index 000000000..6269accf1 --- /dev/null +++ b/docs/getting_started/quick_glance/hello_world/setup.py @@ -0,0 +1,39 @@ +import os + +from setuptools import setup, find_packages + +here = os.path.abspath(os.path.dirname(__file__)) +README = open(os.path.join(here, 'README.txt')).read() +CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() + +requires = ['pyramid>=1.0.2', 'pyramid_jinja2', 'pyramid_debugtoolbar'] + +setup(name='hello_world', + version='0.0', + description='hello_world', + long_description=README + '\n\n' + CHANGES, + classifiers=[ + "Programming Language :: Python", + "Framework :: Pylons", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", + ], + author='', + author_email='', + url='', + keywords='web pyramid pylons', + packages=find_packages(), + include_package_data=True, + zip_safe=False, + install_requires=requires, + tests_require=requires, + test_suite="hello_world", + entry_points="""\ + [paste.app_factory] + main = hello_world:main + """, + paster_plugins=['pyramid'], + extras_require={ + 'testing': ['nose', ], + } +)
\ No newline at end of file diff --git a/docs/getting_started/quick_glance/static/app.css b/docs/getting_started/quick_glance/static/app.css new file mode 100644 index 000000000..f8acf3164 --- /dev/null +++ b/docs/getting_started/quick_glance/static/app.css @@ -0,0 +1,4 @@ +body { + margin: 2em; + font-family: sans-serif; +}
\ No newline at end of file diff --git a/docs/getting_started/routes.rst b/docs/getting_started/routes.rst new file mode 100644 index 000000000..ec4fc988c --- /dev/null +++ b/docs/getting_started/routes.rst @@ -0,0 +1,3 @@ +=========================== +Designing URLs Using Routes +=========================== diff --git a/docs/getting_started/scaffolds.rst b/docs/getting_started/scaffolds.rst new file mode 100644 index 000000000..437291089 --- /dev/null +++ b/docs/getting_started/scaffolds.rst @@ -0,0 +1,3 @@ +==================================== +Starting New Projects With Scaffolds +====================================
\ No newline at end of file diff --git a/docs/getting_started/security.rst b/docs/getting_started/security.rst new file mode 100644 index 000000000..5ba1fb103 --- /dev/null +++ b/docs/getting_started/security.rst @@ -0,0 +1,3 @@ +============================================== +Security With Authentication and Authorization +============================================== diff --git a/docs/getting_started/sessions.rst b/docs/getting_started/sessions.rst new file mode 100644 index 000000000..02e51f9e3 --- /dev/null +++ b/docs/getting_started/sessions.rst @@ -0,0 +1,3 @@ +=============================== +Site Visitor Data With Sessions +=============================== diff --git a/docs/getting_started/special_views.rst b/docs/getting_started/special_views.rst new file mode 100644 index 000000000..c2b384bdb --- /dev/null +++ b/docs/getting_started/special_views.rst @@ -0,0 +1,3 @@ +========================================= +NotFound, Errors, and Other Special Views +========================================= diff --git a/docs/getting_started/static_assets.rst b/docs/getting_started/static_assets.rst new file mode 100644 index 000000000..b605260a7 --- /dev/null +++ b/docs/getting_started/static_assets.rst @@ -0,0 +1,4 @@ +====================================================== +Serving CSS, JavaScript, and Images With Static Assets +====================================================== + diff --git a/docs/getting_started/templates.rst b/docs/getting_started/templates.rst new file mode 100644 index 000000000..32cfea848 --- /dev/null +++ b/docs/getting_started/templates.rst @@ -0,0 +1,4 @@ +============================= +Rendering HTML With Templates +============================= + diff --git a/docs/getting_started/testing.rst b/docs/getting_started/testing.rst new file mode 100644 index 000000000..af2b335b7 --- /dev/null +++ b/docs/getting_started/testing.rst @@ -0,0 +1,4 @@ +================================================= +Coding For Quality With Unit and Functional Tests +================================================= + diff --git a/docs/getting_started/top_ten.rst b/docs/getting_started/top_ten.rst new file mode 100644 index 000000000..071f41d1c --- /dev/null +++ b/docs/getting_started/top_ten.rst @@ -0,0 +1,30 @@ +============================== +Top Killer Features In Pyramid +============================== + +"Making your own framework" + +- Transactions + +- Configuration + + - config.include + +- Advanced views and view predicates + +Custom views +============ + +- Corneice does this + +- Events + +- Ordered routes + +- Custom renderers + +- Tweens + +- Asset specifications + +- Traversal diff --git a/docs/getting_started/views.rst b/docs/getting_started/views.rst new file mode 100644 index 000000000..347d5aae7 --- /dev/null +++ b/docs/getting_started/views.rst @@ -0,0 +1,3 @@ +================================ +Handling Web Requests With Views +================================ diff --git a/docs/index.rst b/docs/index.rst index bc711f8ff..3c3adb9a6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -43,6 +43,16 @@ What's New whatsnew-1.1 whatsnew-1.0 +.. _html_getting_started: + +Getting Started +=============== + +.. toctree:: + :maxdepth: 2 + + getting_started/index + .. _html_narrative_documentation: Narrative documentation diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 9d69a65a5..8cf67e104 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -992,6 +992,8 @@ prompt with a similar configuration as would be loaded if you were running your Pyramid application via ``pserve``. This can be a useful debugging tool. See :ref:`interactive_shell` for more details. +.. _what_is_this_pserve_thing: + What Is This ``pserve`` Thing ----------------------------- |
