From 7af93317a111d328825dd97ec1772143b799bb2e Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 15 Jan 2017 22:42:38 -0600 Subject: update mod_wsgi tutorial to use a cookiecutter closes #2890 --- docs/tutorials/modwsgi/index.rst | 70 +++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 36 deletions(-) (limited to 'docs/tutorials/modwsgi') diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index c66786b11..ef42589c6 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -32,60 +32,59 @@ specific path information for commands and files. `_ for your platform into your system's Apache installation. -#. Create a :term:`virtual environment` which we'll use to install our - application. +#. Create a :app:`Pyramid` application. For this tutorial we'll use the + ``starter`` :term:`cookiecutter`. See :ref:`project_narr` for more + in-depth information about creating a new project. - .. code-block:: text + .. code-block:: bash $ cd ~ - $ mkdir modwsgi - $ cd modwsgi - $ python3 -m venv env + $ cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter + project_name [Pyramid Scaffold]: myproject + repo_name [scaffold]: myproject -#. Install :app:`Pyramid` into the newly created virtual environment: +#. Create a :term:`virtual environment` which we'll use to install our + application. It is important to use the same base Python interpreter + that was used to build ``mod_wsgi``. For example, if ``mod_wsgi`` was + built against the system Python 3.x, then your project should use a + virtual environment created from that same system Python 3.x. - .. parsed-literal:: + .. code-block:: bash - $ cd ~/modwsgi/env - $ $VENV/bin/pip install "pyramid==\ |release|\ " + $ cd myproject + $ python3 -m venv env -#. Create and install your :app:`Pyramid` application. For the purposes of - this tutorial, we'll just be using the ``pyramid_starter`` application as - a baseline application. Substitute your existing :app:`Pyramid` - application as necessary if you already have one. +#. Install your :app:`Pyramid` application and its dependencies. - .. code-block:: text + .. code-block:: bash - $ cd ~/modwsgi/env - $ $VENV/bin/pcreate -s starter myapp - $ cd myapp - $ $VENV/bin/pip install -e . + $ env/bin/pip install -e . -#. Within the virtual environment directory (``~/modwsgi/env``), create a - script named ``pyramid.wsgi``. Give it these contents: +#. Within the project directory (``~/myproject``), create a script + named ``pyramid.wsgi``. Give it these contents: .. code-block:: python from pyramid.paster import get_app, setup_logging - ini_path = '/Users/chrism/modwsgi/env/myapp/production.ini' + ini_path = '/Users/chrism/myproject/production.ini' setup_logging(ini_path) application = get_app(ini_path, 'main') - The first argument to ``get_app`` is the project configuration file - name. It's best to use the ``production.ini`` file provided by your - scaffold, as it contains settings appropriate for - production. The second is the name of the section within the .ini file - that should be loaded by ``mod_wsgi``. The assignment to the name + The first argument to :func:`pyramid.paster.get_app` is the project + configuration file name. It's best to use the ``production.ini`` file + provided by your cookiecutter, as it contains settings appropriate for + production. The second is the name of the section within the ``.ini`` + file that should be loaded by ``mod_wsgi``. The assignment to the name ``application`` is important: mod_wsgi requires finding such an assignment when it opens the file. - The call to ``setup_logging`` initializes the standard library's - `logging` module to allow logging within your application. + The call to :func:`pyramid.paster.setup_logging` initializes the standard + library's `logging` module to allow logging within your application. See :ref:`logging_config`. There is no need to make the ``pyramid.wsgi`` script executable. However, you'll need to make sure that *two* users have access to change - into the ``~/modwsgi/env`` directory: your current user (mine is + into the ``~/myproject`` directory: your current user (mine is ``chrism`` and the user that Apache will run as often named ``apache`` or ``httpd``). Make sure both of these users can "cd" into that directory. @@ -101,18 +100,17 @@ specific path information for commands and files. WSGIApplicationGroup %{GLOBAL} WSGIPassAuthorization On WSGIDaemonProcess pyramid user=chrism group=staff threads=4 \ - python-path=/Users/chrism/modwsgi/env/lib/python2.7/site-packages - WSGIScriptAlias /myapp /Users/chrism/modwsgi/env/pyramid.wsgi + python-path=/Users/chrism/myproject/env/lib/python3.5/site-packages + WSGIScriptAlias /myapp /Users/chrism/myproject/pyramid.wsgi - + WSGIProcessGroup pyramid - Order allow,deny - Allow from all + Require all granted #. Restart Apache - .. code-block:: text + .. code-block:: bash $ sudo /usr/sbin/apachectl restart -- cgit v1.2.3 From ce889449afa3147e77c987067afdcca31bcd9f05 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 3 Feb 2017 12:38:10 -0800 Subject: update links and reST syntax for mod_wsgi --- docs/tutorials/modwsgi/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/tutorials/modwsgi') diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index ef42589c6..0c3b58bac 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -120,5 +120,5 @@ specific path information for commands and files. :term:`mod_wsgi` has many knobs and a great variety of deployment modes. This is just one representation of how you might use it to serve up a :app:`Pyramid` application. See the `mod_wsgi configuration documentation -`_ +`_ for more in-depth configuration information. -- cgit v1.2.3 From 2cd38132e9d6b3506018ae892278d4b7da0d8119 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 28 Feb 2017 13:52:46 -0800 Subject: update pyramid-cookiecutter-starter prompts and reformat presentation of all cookiecutter prompts --- docs/tutorials/modwsgi/index.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'docs/tutorials/modwsgi') diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index 0c3b58bac..44e892a27 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -40,8 +40,19 @@ specific path information for commands and files. $ cd ~ $ cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter - project_name [Pyramid Scaffold]: myproject - repo_name [scaffold]: myproject + + If prompted for the first item, accept the default ``yes`` by hitting return. + + .. code-block:: text + + You've cloned ~/.cookiecutters/pyramid-cookiecutter-starter before. + Is it okay to delete and re-clone it? [yes]: yes + project_name [Pyramid Scaffold]: myproject + repo_name [scaffold]: myproject + Select template_language: + 1 - jinja2 + 2 - chameleon + Choose from 1, 2 [1]: 1 #. Create a :term:`virtual environment` which we'll use to install our application. It is important to use the same base Python interpreter -- cgit v1.2.3 From 6204d8de5484bf7fa26dd41fd32ee3fd9a1047db Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 14 Mar 2017 02:56:00 -0700 Subject: add Mako to options for pyramid-cookiecutter-starter --- docs/tutorials/modwsgi/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/tutorials/modwsgi') diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index 44e892a27..690266586 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -52,7 +52,8 @@ specific path information for commands and files. Select template_language: 1 - jinja2 2 - chameleon - Choose from 1, 2 [1]: 1 + 3 - mako + Choose from 1, 2, 3 [1]: 1 #. Create a :term:`virtual environment` which we'll use to install our application. It is important to use the same base Python interpreter -- cgit v1.2.3 From 6ff6fa265cb48a48daa61247bb1a068852ad13c0 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 23 Apr 2017 23:59:48 -0700 Subject: update user prompt for cookiecutter repo_name - refs: https://github.com/Pylons/pyramid-cookiecutter-starter/pull/27#issuecomment-296507821 --- docs/tutorials/modwsgi/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/tutorials/modwsgi') diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index 690266586..170f2ebc8 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -48,7 +48,7 @@ specific path information for commands and files. You've cloned ~/.cookiecutters/pyramid-cookiecutter-starter before. Is it okay to delete and re-clone it? [yes]: yes project_name [Pyramid Scaffold]: myproject - repo_name [scaffold]: myproject + repo_name [myproject]: myproject Select template_language: 1 - jinja2 2 - chameleon -- cgit v1.2.3