diff options
| author | Paul Everitt <paul@agendaless.com> | 2013-09-16 09:22:24 -0400 |
|---|---|---|
| committer | Paul Everitt <paul@agendaless.com> | 2013-09-16 09:22:24 -0400 |
| commit | 55867d510658e5454e6b73055b944694b69f5668 (patch) | |
| tree | 4bc2ce31579d467494f7424eb15a8aa39477f988 /docs/quick_tutorial/scaffolds.rst | |
| parent | 63e18d797b4f10f6d06ec7ad25d3dadc85147ae2 (diff) | |
| parent | 4524d905975b481aee7f84b079a3abc5036508a6 (diff) | |
| download | pyramid-55867d510658e5454e6b73055b944694b69f5668.tar.gz pyramid-55867d510658e5454e6b73055b944694b69f5668.tar.bz2 pyramid-55867d510658e5454e6b73055b944694b69f5668.zip | |
Merge branch 'docs.quicktutorial'
Diffstat (limited to 'docs/quick_tutorial/scaffolds.rst')
| -rw-r--r-- | docs/quick_tutorial/scaffolds.rst | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst new file mode 100644 index 000000000..7adfe8aa0 --- /dev/null +++ b/docs/quick_tutorial/scaffolds.rst @@ -0,0 +1,84 @@ +============================================= +Prelude: Quick Project Startup with Scaffolds +============================================= + +To ease the process of getting started, Pyramid provides *scaffolds* +that generate sample projects from templates in Pyramid and Pyramid +add-ons. + +Background +========== + +We're going to cover a lot in this tutorial, focusing on one topic at a +time and writing everything from scratch. As a warmup, though, +it sure would be nice to see some pixels on a screen. + +Like other web development frameworks, Pyramid provides a number of +"scaffolds" that generate working Python, template, and CSS code for +sample applications. In this step we'll use a built-in scaffold to let +us preview a Pyramid application, before starting from scratch on Step 1. + +Objectives +========== + +- Use Pyramid's ``pcreate`` command to list scaffolds and make a new + project + +- Start up a Pyramid application and visit it in a web browser + +Steps +===== + +#. Pyramid's ``pcreate`` command can list the available scaffolds: + + .. code-block:: bash + + (venv)$ pcreate --list + Available scaffolds: + alchemy: Pyramid SQLAlchemy project using url dispatch + starter: Pyramid starter project + zodb: Pyramid ZODB project using traversal + +#. Tell ``pcreate`` to use the ``starter`` scaffold to make our project: + + .. code-block:: bash + + (venv)$ pcreate --scaffold starter scaffolds + +#. Use normal Python development to setup our project for development: + + .. code-block:: bash + + (venv)$ cd scaffolds + (venv)$ python setup.py develop + +#. Startup the application by pointing Pyramid's ``pserve`` command at + the project's (generated) configuration file: + + .. code-block:: bash + + (venv)$ pserve development.ini --reload + + On startup, ``pserve`` logs some output: + + .. code-block:: bash + + Starting subprocess with file monitor + Starting server in PID 72213. + Starting HTTP server on http://0.0.0.0:6543 + +#. Open http://localhost:6543/ in your browser. + +Analysis +======== + +Rather than starting from scratch, ``pcreate`` can make getting a +Python project containing a Pyramid application a quick matter. +Pyramid ships with a few scaffolds. But installing a Pyramid add-on can +give you new scaffolds from that add-on. + +``pserve`` is Pyramid's application runner, separating operational +details from your code. When you install Pyramid, a small command +program called ``pserve`` is written to your ``bin`` directory. This +program is an executable Python module. It is passed a configuration +file (in this case, ``development.ini``.) |
