docs/narr/quickstart.rst
author Christophe de Vienne <christophe@unlish.com>
Mon, 06 Jul 2015 14:51:06 +0200
changeset 11587 18dd303225cd
parent 11585 7d6d4edc0ed0
permissions -rw-r--r--
[doc] Document embedding in a pyramid app
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     1
Quick start
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     2
===========
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     3
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
     4
.. highlight:: bash
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     5
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
     6
Prerequites
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
     7
-----------
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     8
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     9
-   Install everything (here with pip, possibly in a virtualenv)::
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    10
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    11
        pip install pyramid-cubicweb cubicweb-pyramid pyramid_debugtoolbar
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    12
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    13
-   Have a working Cubicweb instance, for example:
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    14
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    15
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    16
    -   Make sure CubicWeb is in user mode::
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    17
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    18
            export CW_MODE=user
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    19
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    20
    -   Create a CubicWeb instance, and install the 'pyramid' cube on it (see
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    21
        :ref:`configenv` for more details on this step)::
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    22
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    23
            cubicweb-ctl create pyramid myinstance
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    24
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    25
-   Edit your ``~/etc/cubicweb.d/myinstance/all-in-one.conf`` and set values for
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    26
    :confval:`pyramid-auth-secret` and :confval:`pyramid-session-secret`.
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    27
    *required if pyramid_cubicweb.auth and pyramid_cubiweb.session get
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    28
    included, which is the default*
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    29
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    30
From CubicWeb
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    31
-------------
11537
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    32
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    33
-   Start the instance with the :ref:`'pyramid' command <cubicweb-ctl_pyramid>`
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    34
    instead of 'start'::
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    35
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    36
        cubicweb-ctl pyramid --debug myinstance
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    37
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    38
In a pyramid application
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    39
------------------------
caf268942436 Initial documentation.
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    40
11587
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    41
-   Create a pyramid application
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    42
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    43
-   Include pyramid_cubicweb:
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    44
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    45
    .. code-block:: python
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    46
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    47
        def includeme(config):
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    48
            # ...
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    49
            config.include('pyramid_cubicweb')
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    50
            # ...
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    51
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    52
-   Configure the instance name (in the .ini file):
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    53
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    54
    .. code-block:: ini
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    55
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    56
        cubicweb.instance = myinstance
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    57
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    58
-   Configure the base-url and https-url in all-in-one.conf to match the ones
18dd303225cd [doc] Document embedding in a pyramid app
Christophe de Vienne <christophe@unlish.com>
parents: 11585
diff changeset
    59
    of the pyramid configuration (this is a temporary limitation).