diff options
| author | Michael Merickel <michael@merickel.org> | 2017-01-15 23:25:32 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-15 23:25:32 -0600 |
| commit | 0590e5fee581899dbf6fc6d6bc5a07044ab5b518 (patch) | |
| tree | 9eb4c3423c2874a2e2f8244a7f63ae49c5bf8009 /docs | |
| parent | 8eac26ea9b30d5683d70275cda32952b4927b4d9 (diff) | |
| parent | 7af93317a111d328825dd97ec1772143b799bb2e (diff) | |
| download | pyramid-0590e5fee581899dbf6fc6d6bc5a07044ab5b518.tar.gz pyramid-0590e5fee581899dbf6fc6d6bc5a07044ab5b518.tar.bz2 pyramid-0590e5fee581899dbf6fc6d6bc5a07044ab5b518.zip | |
Merge pull request #2901 from mmerickel/mod-wsgi-cookiecutter
update mod_wsgi tutorial to use a cookiecutter
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/tutorials/modwsgi/index.rst | 70 |
1 files changed, 34 insertions, 36 deletions
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. <https://code.google.com/archive/p/modwsgi/wikis/InstallationInstructions.wiki>`_ 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 - <Directory /Users/chrism/modwsgi/env> + <Directory /Users/chrism/myproject> WSGIProcessGroup pyramid - Order allow,deny - Allow from all + Require all granted </Directory> #. Restart Apache - .. code-block:: text + .. code-block:: bash $ sudo /usr/sbin/apachectl restart |
