heroku.rst 2.3 KB
Newer Older
Sharif Mehedi's avatar
Sharif Mehedi committed
1
2
.. hg.heroku

Luc Saffre's avatar
Luc Saffre committed
3
4
5
6
=============================
Running a Lino site on Heroku
=============================

Sharif Mehedi's avatar
Sharif Mehedi committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
This tutorial is Ubuntu 16+ specific. If you are using other platforms most of
the instructions will remain the same and some other instructions may vary to
some degree. To understand more about heroku, visit `heroku devcenter
<https://devcenter.heroku.com/articles/getting-started-with-python>`_. If you
are having trouble following this tutorial, contact us for help.

- Create an account at Heroku:

    If you  do not have an account on `heroku <https://heroku.com>`_, click on
    this `link <https://signup.heroku.com>`_ to fill up the form and follow the
    flow to create an account of heroku.

- Install heroku on your local machine:

    If you are using Ubuntu 16+ then use the following command to install
    heroku::

        $ sudo snap install heroku --classic

    Otherwise follow the instruction on heroku `devcenter
    <https://devcenter.heroku.com/articles/getting-started-with-python#set-up>`_.

- Heroku CLI login:

    Use the following command::

        $ heroku login

    This will open a page in your browser. Fill up the login information and
    `Log In` to heroku. This will log you on in heroku CLI.

- Get a clone of the `heroku-template <https://gitlab.com/lino-framework/heroku-template>`_ repository from GitLab::

    $ git clone https://gitlab.com/lino-framework/heroku-template.git
    $ cd heroku-template

- Create a heroku app::

    $ heroku create my-lino-app

- Modify settings.py and heroku config:

    Set the **ALLOWED_HOSTS** variable in amici1/settings.py file to include our
    app hostname (is our case this would be) `my-lino-app.herokuapp.com`. The
    value for the ALLOWED_HOSTS variable should be::

        ALLOWED_HOSTS = ['my-lino-app.herokuapp.com']

    Set the :attr:`Site.title` attribute to "my-lino-app".

    Lino uses an extended collectstatic and to pass extra options to it we need
    to disable heroku's default collectstatic command. To do this use the
    following command::

        $ heroku config:set DISABLE_COLLECTSTATIC=1

    And see `Procfile` to get a glimpse of the collectstatic command.

- Deploy on heroku::

    $ git push heroku master

After when the final command is done, you can access your app visiting the url
https://my-lino-app.herokuapp.com/