doc/tutorials/base/blog-in-five-minutes.rst
author Laurent Peuch <cortex@worlddomination.be>
Tue, 12 Feb 2019 14:43:45 +0100
branch3.26
changeset 12362 aa3581fc685c
parent 10491 c67bcee93248
child 12379 04348101688a
child 12436 d24f45087808
permissions -rw-r--r--
[doc] how to install pyramid or twisted application server
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
     2
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
     3
.. _TutosBaseBlogFiveMinutes:
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
     4
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2174
diff changeset
     5
Get a blog running in five minutes!
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2174
diff changeset
     6
-----------------------------------
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
     7
6833
8fe4b003c1bc [doc] some ReST syntax fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5432
diff changeset
     8
For Debian or Ubuntu users, first install the following packages
8fe4b003c1bc [doc] some ReST syntax fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5432
diff changeset
     9
(:ref:`DebianInstallation`)::
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    10
12362
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    11
    cubicweb, cubicweb-dev, cubicweb-twisted, cubicweb-blog
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    12
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    13
Windows or Mac OS X users must install |cubicweb| from source (see
6833
8fe4b003c1bc [doc] some ReST syntax fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5432
diff changeset
    14
:ref:`SourceInstallation` and :ref:`WindowsInstallation`).
4431
e597e0ca67cd Updated CW tutorial.
Adrien Chauve <adrien.chauve@logilab.fr>
parents: 4143
diff changeset
    15
12362
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    16
You can also install those packages using pip in a virtualenv::
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    17
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    18
   virtualenv venv
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    19
   source venv/bin/activate
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    20
   pip install cubicweb[etwist] cubicweb-dev cubicweb-blog
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    21
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2174
diff changeset
    22
Then create and initialize your instance::
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1715
diff changeset
    23
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    24
    cubicweb-ctl create blog myblog
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    25
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    26
You'll be asked a few questions, and you can keep the default answer for most of
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    27
them. The one question you'll have to think about is the database you'll want to
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    28
use for that instance. For a quick test, if you don't have `postgresql` installed
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    29
and configured (see :ref:`PostgresqlConfiguration`), it's highly recommended to
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    30
choose `sqlite` when asked for which database driver to use, since it has a much
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    31
simple setup (no database server needed).
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    32
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    33
One the process is completed (including database initialisation), you can start
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    34
your instance by using: ::
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    35
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    36
    cubicweb-ctl start -D myblog
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    37
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    38
The `-D` option activates the debugging mode. Removing it will launch the instance
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    39
as a daemon in the background, and ``cubicweb-ctl stop myblog`` will stop
12362
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    40
it in that case.
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    41
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    42
.. Note::
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    43
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    44
   If you get a traceback when going on the web interface make sure your
aa3581fc685c [doc] how to install pyramid or twisted application server
Laurent Peuch <cortex@worlddomination.be>
parents: 10491
diff changeset
    45
   version of twisted is **inferior** to 17.
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    46
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    47
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    48
About file system permissions
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    49
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4143
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    50
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    51
Unless you installed from sources, the above commands assume that you have root
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    52
access to the :file:`/etc/` directory. In order to initialize your instance as a
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    53
regular user, within your home directory, you can use the :envvar:`CW_MODE`
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    54
environment variable: ::
4143
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    55
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    56
  export CW_MODE=user
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    57
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    58
then create a :file:`~/etc/cubicweb.d` directory that will hold your instances.
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    59
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    60
More information about how to configure your own environment is
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    61
available in :ref:`ResourceMode`.
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    62
4143
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    63
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    64
Instance parameters
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    65
~~~~~~~~~~~~~~~~~~~
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    66
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    67
If you would like to change database parameters such as the database host or the
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    68
user name used to connect to the database, edit the `sources` file located in the
6833
8fe4b003c1bc [doc] some ReST syntax fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5432
diff changeset
    69
:file:`/etc/cubicweb.d/myblog` directory.
4143
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    70
5432
ee246e1813c6 [doc] various small improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 5253
diff changeset
    71
Then relaunch the database creation::
4143
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    72
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    73
     cubicweb-ctl db-create myblog
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    74
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    75
Other parameters, like web server or emails parameters, can be modified in the
6833
8fe4b003c1bc [doc] some ReST syntax fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5432
diff changeset
    76
:file:`/etc/cubicweb.d/myblog/all-in-one.conf` file.
4143
e6d936eef7aa [mq]: doc
Charles Hébert
parents: 2175
diff changeset
    77
6835
87e2641d75f7 [doc] major rework of the simple blog tutorial
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6833
diff changeset
    78
You'll have to restart the instance after modification in one of those files.
1210
47a3eb4bbe66 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff changeset
    79
6837
7562418985ef tutorial proof reading
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6835
diff changeset
    80
This is it. Your blog is functional and running. Visit http://localhost:8080 and enjoy it!