From b1b92284f496800a4dfd2cea72cb9be07ba8661c Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Fri, 13 Sep 2013 16:52:14 -0400 Subject: First cut at import of quick tutorial. --- docs/quick_tutorial/scaffolds.rst | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 docs/quick_tutorial/scaffolds.rst (limited to 'docs/quick_tutorial/scaffolds.rst') diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst new file mode 100644 index 000000000..cbd198414 --- /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 + + (env27)$ 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 + + (env27)$ pcreate --scaffold starter scaffolds + +#. Use normal Python development to setup our project for development: + + .. code-block:: bash + + (env27)$ cd scaffolds + (env27)$ python setup.py develop + +#. Startup the application by pointing Pyramid's ``pserve`` command at + the project's (generated) configuration file: + + .. code-block:: bash + + (env27)$ 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``.) -- cgit v1.2.3 From 0a784868bdbc3a0eb226ed00e8d89cda9d181ec5 Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Fri, 13 Sep 2013 17:11:42 -0400 Subject: Fix naming of virtualenv prefix. --- docs/quick_tutorial/scaffolds.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/quick_tutorial/scaffolds.rst') diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst index cbd198414..b13bdec0b 100644 --- a/docs/quick_tutorial/scaffolds.rst +++ b/docs/quick_tutorial/scaffolds.rst @@ -33,7 +33,7 @@ Steps .. code-block:: bash - (env27)$ pcreate --list + (env)$ pcreate --list Available scaffolds: alchemy: Pyramid SQLAlchemy project using url dispatch starter: Pyramid starter project @@ -43,21 +43,21 @@ Steps .. code-block:: bash - (env27)$ pcreate --scaffold starter scaffolds + (env)$ pcreate --scaffold starter scaffolds #. Use normal Python development to setup our project for development: .. code-block:: bash - (env27)$ cd scaffolds - (env27)$ python setup.py develop + (env)$ cd scaffolds + (env)$ python setup.py develop #. Startup the application by pointing Pyramid's ``pserve`` command at the project's (generated) configuration file: .. code-block:: bash - (env27)$ pserve development.ini --reload + (env)$ pserve development.ini --reload On startup, ``pserve`` logs some output: -- cgit v1.2.3 From b0b28ede912c817a62a84b97c332e39eda02d166 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 16 Sep 2013 02:14:53 +0200 Subject: s/env/venv just for sake of consistency --- docs/quick_tutorial/scaffolds.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/quick_tutorial/scaffolds.rst') diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst index b13bdec0b..05347dd6b 100644 --- a/docs/quick_tutorial/scaffolds.rst +++ b/docs/quick_tutorial/scaffolds.rst @@ -33,7 +33,7 @@ Steps .. code-block:: bash - (env)$ pcreate --list + (venv)$ pcreate --list Available scaffolds: alchemy: Pyramid SQLAlchemy project using url dispatch starter: Pyramid starter project @@ -43,21 +43,21 @@ Steps .. code-block:: bash - (env)$ pcreate --scaffold starter scaffolds + (venv)$ pcreate --scaffold starter scaffolds #. Use normal Python development to setup our project for development: .. code-block:: bash - (env)$ cd scaffolds - (env)$ python setup.py develop + (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 - (env)$ pserve development.ini --reload + (venv)$ pserve development.ini --reload On startup, ``pserve`` logs some output: -- cgit v1.2.3 From d749bf4c987c4ab90bd5f89326e7d4059e4f47b3 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 16 Sep 2013 02:18:11 +0200 Subject: make example links clickable, for convenience --- docs/quick_tutorial/scaffolds.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/quick_tutorial/scaffolds.rst') diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst index 05347dd6b..7adfe8aa0 100644 --- a/docs/quick_tutorial/scaffolds.rst +++ b/docs/quick_tutorial/scaffolds.rst @@ -67,7 +67,7 @@ Steps Starting server in PID 72213. Starting HTTP server on http://0.0.0.0:6543 -#. Open ``http://localhost:6543/`` in your browser. +#. Open http://localhost:6543/ in your browser. Analysis ======== -- cgit v1.2.3 From 187104fd81418beeb51592913041d9751bafe08d Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Wed, 25 Sep 2013 09:27:43 -0400 Subject: Quick Tutorial: Improve the setup instructions (adapted from Steve Piercy's work), particularly for Windows. Change all the steps to use $VENV/bin prefixes on commands (don't presume that they have done source env/bin/activate). --- docs/quick_tutorial/scaffolds.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/quick_tutorial/scaffolds.rst') diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst index 7adfe8aa0..c8f6d5c66 100644 --- a/docs/quick_tutorial/scaffolds.rst +++ b/docs/quick_tutorial/scaffolds.rst @@ -33,7 +33,7 @@ Steps .. code-block:: bash - (venv)$ pcreate --list + $ $VENV/bin/pcreate --list Available scaffolds: alchemy: Pyramid SQLAlchemy project using url dispatch starter: Pyramid starter project @@ -43,21 +43,21 @@ Steps .. code-block:: bash - (venv)$ pcreate --scaffold starter scaffolds + $ $VENV/bin/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 + $ cd scaffolds + $ $VENV/bin/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 + $ $VENV/bin/pserve development.ini --reload On startup, ``pserve`` logs some output: -- cgit v1.2.3 From b731b5fca253d9d95b3307490aa585e194676c01 Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Thu, 26 Sep 2013 17:41:44 -0400 Subject: Quick Tour: shorten the setup part and point to Quick Tutorial Requirements for more explanation. Cross link each Quick Tour section with its Quick Tutorial match. --- docs/quick_tutorial/scaffolds.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/quick_tutorial/scaffolds.rst') diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst index c8f6d5c66..8ca2d27df 100644 --- a/docs/quick_tutorial/scaffolds.rst +++ b/docs/quick_tutorial/scaffolds.rst @@ -1,3 +1,5 @@ +.. _qtut_scaffolds: + ============================================= Prelude: Quick Project Startup with Scaffolds ============================================= -- cgit v1.2.3