Sunday, August 7, 2016

An equivalent of startproject for Lino

Once more thanks to Grigorij who reported his problems with the A Local Exchange Trade System. His report made me see the next steps I can do for making the Developer's Guide better.

Two immediate changes to the current A Local Exchange Trade System:

  • Remove the last line from your models.py file (the one which says from .ui import *) and rename ui.py to desktop.py. This is because we now have layout_name.
  • In your settings.py, change “self.modules” to “self.actors”. (See lino.core.site.Site.actors)

Note, Grigorij, that these changes are not related to your problems. Your problems come probably because the tutorial uses somewhat hackerish manage.py and settings.py files.

But more importantly, I started to convert this tutorial into an independent project on GitGub so that it can serve as a template for new Lino applications: Lino Algus.

TODO: Write a tutorial about how to use Lino Algus. Adapt A Local Exchange Trade System.

I had the following error message when doing inv release:

error: Upload failed (403): You are not allowed to edit 'lino-algus' package information

This was simply because on the first release on PyPI you must say setup.py register instead of setup.py sdist upload.

ImportError: No module named appy_renderer

This one happened on a production server:

Traceback (most recent call last):

  File "env/repositories/xl/lino_xl/lib/lists/models.py", line 41, in <module>
    from lino_xl.lib.appypod.mixins import PrintLabelsAction
  File "env/repositories/xl/lino_xl/lib/appypod/mixins.py", line 34, in <module>
    from .appy_renderer import AppyRenderer
ImportError: No module named appy_renderer

The problem is here:

$ ls -al env/repositories/xl/lino_xl/lib/appypod
total 96
drwxrwxr-x  3 admin    www-data  4096 Aug  7 06:25 .
drwxrwxr-x 39 admin    www-data  4096 Aug  6 09:41 ..
-rw-rw----  1 admin    admin    24403 Aug  6 09:40 appy_renderer.py
-rw-rw----  1 root     root     18439 Aug  7 06:25 appy_renderer.pyc
-rw-rw-r--  1 admin    www-data  3839 Aug  5 21:04 choicelists.py
-rw-rw-r--  1 root     root      3903 Aug  7 06:25 choicelists.pyc
drwxrwxr-x  2 admin    www-data  4096 Aug  5 21:04 config
-rw-rw-r--  1 admin    www-data  1853 Aug  5 21:04 __init__.py
-rw-rw-r--  1 www-data www-data  1576 Aug  6 09:41 __init__.pyc
-rw-rw-r--  1 admin    www-data  4999 Aug  5 21:04 mixins.py
-rw-rw-r--  1 www-data www-data  5293 Aug  6 09:41 mixins.pyc
-rw-rw-r--  1 admin    www-data  1571 Aug  5 21:04 models.py
-rw-rw-r--  1 root     root      1147 Aug  7 06:25 models.pyc

The directory doesn’t have the SETGID sticky bit set. The cron job which does a daily snapshot (it runs every morning at 6:25) is running as root.

While working on this I updated File permissions (which becomes better but it still work in process).