doc/book/pyramid/quickstart.rst
branch3.25
changeset 12097 78a5c6a64fad
parent 11945 ef6b18c56b5a
equal deleted inserted replaced
12096:b8bfcab1a91c 12097:78a5c6a64fad
     4 .. highlight:: bash
     4 .. highlight:: bash
     5 
     5 
     6 Prerequites
     6 Prerequites
     7 -----------
     7 -----------
     8 
     8 
     9 -   Install everything (here with pip, possibly in a virtualenv)::
     9 Install the *pyramid* flavour of CubicWeb (here with pip, possibly in a
       
    10 virtualenv):
    10 
    11 
    11         pip install pyramid-cubicweb cubicweb-pyramid pyramid_debugtoolbar
    12 ::
    12 
    13 
    13 -   Have a working Cubicweb instance, for example:
    14         pip install cubicweb[pyramid]
    14 
    15 
    15 
    16 
    16     -   Make sure CubicWeb is in user mode::
    17 Instance creation and running
       
    18 -----------------------------
    17 
    19 
    18             export CW_MODE=user
    20 In *backwards compatible* mode
       
    21 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    19 
    22 
    20     -   Create a CubicWeb instance, and install the 'pyramid' cube on it (see
    23 In this mode, you can simply create an instance of kind ``all-in-one`` with
    21         :ref:`configenv` for more details on this step)::
    24 the ``cubicweb-ctl create`` command. You'll then need to add a ``pyramid.ini``
       
    25 file in your instance directory, see :ref:`pyramid_settings` for details about the
       
    26 content of this file.
    22 
    27 
    23             cubicweb-ctl create pyramid myinstance
    28 Start the instance with the :ref:`'pyramid' command <cubicweb-ctl_pyramid>`
       
    29 instead of 'start':
    24 
    30 
    25 -   Edit your ``~/etc/cubicweb.d/myinstance/all-in-one.conf`` and set values for
    31 ::
    26     :confval:`pyramid-auth-secret` and :confval:`pyramid-session-secret`.
       
    27     *required if cubicweb.pyramid.auth and pyramid_cubiweb.session get
       
    28     included, which is the default*
       
    29 
    32 
    30 From CubicWeb
    33     cubicweb-ctl pyramid --debug myinstance
    31 -------------
       
    32 
    34 
    33 -   Start the instance with the :ref:`'pyramid' command <cubicweb-ctl_pyramid>`
       
    34     instead of 'start'::
       
    35 
    35 
    36         cubicweb-ctl pyramid --debug myinstance
    36 Without *backwards compatibility*
       
    37 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    38 
       
    39 In this mode, you can create an instance of kind ``pyramid`` as follow:
       
    40 
       
    41 ::
       
    42 
       
    43     cubicweb-ctl create -c pyramid <cube_name> <instance_name>
       
    44 
       
    45 This will bootstrap a ``development.ini`` file typical of a Pyramid
       
    46 application in the instance's directory. The new instance may then be launched
       
    47 by any WSGI server, for instance with pserve_:
       
    48 
       
    49 ::
       
    50 
       
    51     pserve etc/cubicweb.d/<instance_name>/development.ini
       
    52 
    37 
    53 
    38 In a pyramid application
    54 In a pyramid application
    39 ------------------------
    55 ~~~~~~~~~~~~~~~~~~~~~~~~
    40 
    56 
    41 -   Create a pyramid application
    57 -   Create a pyramid application
    42 
    58 
    43 -   Include cubicweb.pyramid:
    59 -   Include cubicweb.pyramid:
    44 
    60 
    53 
    69 
    54     .. code-block:: ini
    70     .. code-block:: ini
    55 
    71 
    56         cubicweb.instance = myinstance
    72         cubicweb.instance = myinstance
    57 
    73 
    58 -   Configure the base-url and https-url in all-in-one.conf to match the ones
    74 -   Configure the base-url in all-in-one.conf to match the ones of the pyramid
    59     of the pyramid configuration (this is a temporary limitation).
    75     configuration (this is a temporary limitation).
    60 
       
    61 
       
    62 Usage with pserve
       
    63 -----------------
       
    64 
       
    65 To run a Pyramid application using pserve_:
       
    66 
       
    67 ::
       
    68 
       
    69     pserve /path/to/development.ini instance=<appid>
       
    70 
    76 
    71 
    77 
    72 .. _pserve: \
    78 .. _pserve: \
    73     http://docs.pylonsproject.org/projects/pyramid/en/latest/pscripts/pserve.html
    79     http://docs.pylonsproject.org/projects/pyramid/en/latest/pscripts/pserve.html