doc/book/pyramid/quickstart.rst
author Philippe Pepiot <ph@itsalwaysdns.eu>
Tue, 31 Mar 2020 18:22:05 +0200
changeset 12966 6cd938c29ca3
parent 12097 78a5c6a64fad
permissions -rw-r--r--
[server] Make connection pooler configurable and set better default values Drop the configuration connections-pool-size and add new configurations options: * connections-pool-min-size. Set to 0 by default so we open connections only when needed. This avoid opening min-size*processes connections at startup, which is, it think, a good default. * connections-pool-max-size. Set to 0 (unlimited) by default, so we move the bottleneck to postgresql. * connections-idle-timeout. Set to 10 minutes. I don't have arguments about this except that this is the default in pgbouncer.

Quick start
===========

.. highlight:: bash

Prerequites
-----------

Install the *pyramid* flavour of CubicWeb (here with pip, possibly in a
virtualenv):

::

        pip install cubicweb[pyramid]


Instance creation and running
-----------------------------

In *backwards compatible* mode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In this mode, you can simply create an instance of kind ``all-in-one`` with
the ``cubicweb-ctl create`` command. You'll then need to add a ``pyramid.ini``
file in your instance directory, see :ref:`pyramid_settings` for details about the
content of this file.

Start the instance with the :ref:`'pyramid' command <cubicweb-ctl_pyramid>`
instead of 'start':

::

    cubicweb-ctl pyramid --debug myinstance


Without *backwards compatibility*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In this mode, you can create an instance of kind ``pyramid`` as follow:

::

    cubicweb-ctl create -c pyramid <cube_name> <instance_name>

This will bootstrap a ``development.ini`` file typical of a Pyramid
application in the instance's directory. The new instance may then be launched
by any WSGI server, for instance with pserve_:

::

    pserve etc/cubicweb.d/<instance_name>/development.ini


In a pyramid application
~~~~~~~~~~~~~~~~~~~~~~~~

-   Create a pyramid application

-   Include cubicweb.pyramid:

    .. code-block:: python

        def includeme(config):
            # ...
            config.include('cubicweb.pyramid')
            # ...

-   Configure the instance name (in the .ini file):

    .. code-block:: ini

        cubicweb.instance = myinstance

-   Configure the base-url in all-in-one.conf to match the ones of the pyramid
    configuration (this is a temporary limitation).


.. _pserve: \
    http://docs.pylonsproject.org/projects/pyramid/en/latest/pscripts/pserve.html