diff options
| author | Steve Piercy <web@stevepiercy.com> | 2018-08-18 03:55:04 -0700 |
|---|---|---|
| committer | Steve Piercy <web@stevepiercy.com> | 2018-08-18 03:55:04 -0700 |
| commit | f0740851106f6b558107ebe5d423daba521d6826 (patch) | |
| tree | 785466b4c44a249b712ec2ec80f2202bb40da74a | |
| parent | 7c1ce4032aaf779f925f54c9544318df59ad70e1 (diff) | |
| download | pyramid-f0740851106f6b558107ebe5d423daba521d6826.tar.gz pyramid-f0740851106f6b558107ebe5d423daba521d6826.tar.bz2 pyramid-f0740851106f6b558107ebe5d423daba521d6826.zip | |
Clean up code-blocks in project
| -rw-r--r-- | docs/narr/project.rst | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 5234d89d1..4940543f6 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -85,7 +85,7 @@ On all platforms, generate a project using cookiecutter. .. code-block:: bash - $ cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout master + cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout master If prompted for the first item, accept the default ``yes`` by hitting return. @@ -108,26 +108,26 @@ On UNIX: .. code-block:: bash # Reset our environment variable for a new virtual environment. - $ export VENV=~/env/myproject/env + export VENV=~/env/myproject/env # Change directory into your newly created project. - $ cd myproject + cd myproject # Create a new virtual environment... - $ python3 -m venv $VENV + python3 -m venv $VENV # ...where we upgrade packaging tools. - $ env/bin/pip install --upgrade pip setuptools + env/bin/pip install --upgrade pip setuptools Or on Windows: .. code-block:: doscon # Reset our environment variable for a new virtual environment. - c:\> set VENV=c:\env\myproject\env + set VENV=c:\env\myproject\env # Change directory into your newly created project. - c:\> cd myproject + cd myproject # Create a new virtual environment... - c:\myproject> python -m venv %VENV% + python -m venv %VENV% # ...where we upgrade packaging tools. - c:\myproject> %VENV%\Scripts\pip install --upgrade pip setuptools + %VENV%\Scripts\pip install --upgrade pip setuptools As a result of invoking the ``cookiecutter`` command, a directory named ``myproject`` is created. That directory is a :term:`project` directory. The @@ -192,19 +192,19 @@ On UNIX: .. code-block:: bash - $ $VENV/bin/pip install -e . + $VENV/bin/pip install -e . Or on Windows: .. code-block:: doscon - c:\env\myproject> %VENV%\Scripts\pip install -e . + %VENV%\Scripts\pip install -e . Elided output from a run of this command on UNIX is shown below: .. code-block:: bash - Running setup.py develop for myproject + Running setup.py develop for myproject Successfully installed Jinja2-2.8 Mako-1.0.6 MarkupSafe-0.23 \ PasteDeploy-1.5.2 Pygments-2.1.3 WebOb-1.7.0 myproject pyramid-1.7.3 \ pyramid-debugtoolbar-3.0.5 pyramid-jinja2-2.7 pyramid-mako-1.0.2 \ @@ -230,13 +230,13 @@ On UNIX: .. code-block:: bash - $ $VENV/bin/pip install -e ".[testing]" + $VENV/bin/pip install -e ".[testing]" On Windows: .. code-block:: doscon - c:\env\myproject> %VENV%\Scripts\pip install -e ".[testing]" + %VENV%\Scripts\pip install -e ".[testing]" Once the testing requirements are installed, then you can run the tests using the ``py.test`` command that was just installed in the ``bin`` directory of @@ -246,21 +246,21 @@ On UNIX: .. code-block:: bash - $ $VENV/bin/py.test -q + $VENV/bin/py.test -q On Windows: .. code-block:: doscon - c:\env\myproject> %VENV%\Scripts\py.test -q + %VENV%\Scripts\py.test -q Here's sample output from a test run on UNIX: .. code-block:: bash - $ $VENV/bin/py.test -q - .. - 2 passed in 0.47 seconds + $VENV/bin/py.test -q + .. + 2 passed in 0.47 seconds The tests themselves are found in the ``tests.py`` module in your ``cookiecutter``-generated project. Within a project generated by the ``pyramid-cookiecutter-starter`` cookiecutter, only two sample tests exist. @@ -275,7 +275,7 @@ to ``py.test``: .. code-block:: bash - $ $VENV/bin/py.test --cov -q + $VENV/bin/py.test --cov -q Cookiecutters include configuration defaults for ``py.test`` and test coverage. These configuration files are ``pytest.ini`` and ``.coveragerc``, located at @@ -284,7 +284,7 @@ path to the module on which we want to run tests and coverage. .. code-block:: bash - $ $VENV/bin/py.test --cov=myproject myproject/tests.py -q + $VENV/bin/py.test --cov=myproject myproject/tests.py -q .. seealso:: See py.test's documentation for :ref:`pytest:usage` or invoke ``py.test -h`` to see its full set of options. @@ -311,22 +311,22 @@ On UNIX: .. code-block:: bash - $ $VENV/bin/pserve development.ini + $VENV/bin/pserve development.ini On Windows: .. code-block:: doscon - c:\env\myproject> %VENV%\Scripts\pserve development.ini + %VENV%\Scripts\pserve development.ini Here's sample output from a run of ``pserve`` on UNIX: .. code-block:: bash - $ $VENV/bin/pserve development.ini - Starting server in PID 77171. - Serving on http://localhost:6543 - Serving on http://localhost:6543 + $VENV/bin/pserve development.ini + Starting server in PID 77171. + Serving on http://localhost:6543 + Serving on http://localhost:6543 Access is restricted such that only a browser running on the same machine as Pyramid will be able to access your Pyramid application. However, if you want @@ -337,9 +337,9 @@ to open access to other machines on the same network, then edit the .. code-block:: ini - [server:main] - use = egg:waitress#main - listen = *:6543 + [server:main] + use = egg:waitress#main + listen = *:6543 Now when you use ``pserve`` to start the application, it will respond to requests on *all* IP addresses possessed by your system, not just requests to @@ -398,22 +398,22 @@ For example, on UNIX: .. code-block:: text - $ $VENV/bin/pserve development.ini --reload - Starting subprocess with file monitor - Starting server in PID 16601. - Serving on http://localhost:6543 - Serving on http://localhost:6543 + $VENV/bin/pserve development.ini --reload + Starting subprocess with file monitor + Starting server in PID 16601. + Serving on http://localhost:6543 + Serving on http://localhost:6543 Now if you make a change to any of your project's ``.py`` files or ``.ini`` files, you'll see the server restart automatically: .. code-block:: text - development.ini changed; reloading... - -------------------- Restarting -------------------- - Starting server in PID 16602. - Serving on http://localhost:6543 - Serving on http://localhost:6543 + development.ini changed; reloading... + -------------------- Restarting -------------------- + Starting server in PID 16602. + Serving on http://localhost:6543 + Serving on http://localhost:6543 Changes to template files (such as ``.pt`` or ``.mak`` files) won't cause the server to restart. Changes to template files don't require a server restart as @@ -466,9 +466,9 @@ like this to enable the toolbar when your system contacts Pyramid: .. code-block:: ini - [app:main] - # .. other settings ... - debugtoolbar.hosts = 192.168.1.1 + [app:main] + # .. other settings ... + debugtoolbar.hosts = 192.168.1.1 For more information about what the debug toolbar allows you to do, see the :ref:`documentation for pyramid_debugtoolbar <toolbar:overview>`. @@ -481,22 +481,22 @@ You can also turn the debug toolbar off by editing ``development.ini`` and commenting out a line. For example, instead of: .. code-block:: ini - :linenos: + :linenos: - [app:main] - # ... elided configuration - pyramid.includes = - pyramid_debugtoolbar + [app:main] + # ... elided configuration + pyramid.includes = + pyramid_debugtoolbar Put a hash mark at the beginning of the ``pyramid_debugtoolbar`` line: .. code-block:: ini - :linenos: + :linenos: - [app:main] - # ... elided configuration - pyramid.includes = - # pyramid_debugtoolbar + [app:main] + # ... elided configuration + pyramid.includes = + # pyramid_debugtoolbar Then restart the application to see that the toolbar has been turned off. @@ -507,7 +507,7 @@ this: .. code-block:: text - ImportError: No module named #pyramid_debugtoolbar + ImportError: No module named #pyramid_debugtoolbar .. index:: single: project structure @@ -525,26 +525,26 @@ The ``myproject`` project we've generated has the following directory structure: .. code-block:: text - myproject/ - ├── .coveragerc - ├── CHANGES.txt - ├── MANIFEST.in - ├── myproject - │ ├── __init__.py - │ ├── static - │ │ ├── pyramid-16x16.png - │ │ ├── pyramid.png - │ │ └── theme.css - │ ├── templates - │ │ ├── layout.jinja2 - │ │ └── mytemplate.jinja2 - │ ├── tests.py - │ └── views.py - ├── README.txt - ├── development.ini - ├── production.ini - ├── pytest.ini - └── setup.py + myproject/ + ├── .coveragerc + ├── CHANGES.txt + ├── MANIFEST.in + ├── myproject + │ ├── __init__.py + │ ├── static + │ │ ├── pyramid-16x16.png + │ │ ├── pyramid.png + │ │ └── theme.css + │ ├── templates + │ │ ├── layout.jinja2 + │ │ └── mytemplate.jinja2 + │ ├── tests.py + │ └── views.py + ├── README.txt + ├── development.ini + ├── production.ini + ├── pytest.ini + └── setup.py The ``myproject`` :term:`Project` @@ -785,7 +785,7 @@ you can try this command now: .. code-block:: text - $ $VENV/bin/python setup.py sdist + $VENV/bin/python setup.py sdist This will create a tarball of your application in a ``dist`` subdirectory named ``myproject-0.0.tar.gz``. You can send this tarball to other people who want |
