PrePopulate not work?

30 views
Skip to first unread message

Tuan TRUONG

unread,
Sep 25, 2024, 6:58:35 AM9/25/24
to Sahana-Eden
I got a newly installed of Sahana.

Then I tried to PrePopulate some demo data following this guide: https://eden.sahanafoundation.org/wiki/DeveloperGuidelines/Basics#Pre-PopulatingData
however, it doesn't work (no prepopulated data at all after web2py restarted)
I tried another way to change the template from "default" to "IFRC" but I see no luck;

Anyone got the same problems?

Fran Boon

unread,
Oct 2, 2024, 6:45:26 AM10/2/24
to sahan...@googlegroups.com
On Wed, 25 Sept 2024 at 11:58, Tuan TRUONG <tat...@gmail.com> wrote:
I got a newly installed of Sahana.

So latest Trunk from GitHub?
Using which Installation method? (I have just made some updates to the Developer/Manual path as I see it was ancient!)
Critical things to consider are versions of Python & Web2Py
I tested using Python 3.10 & Web2Py 2.21.2 (31905858b7f2cf72ce778ea8108cbbbb4f721f15)

Then I tried to PrePopulate some demo data following this guide: https://eden.sahanafoundation.org/wiki/DeveloperGuidelines/Basics#Pre-PopulatingData

I see the docs are slightly out of date as no IFRCTrain template (fixed), but the IFRC template does still exist, and this has an option to install the IFRCTrain data still:
https://github.com/sahana/eden/blob/master/modules/templates/IFRC/config.py#L45

Even the default should install default users though.
It does for me....*if* the contents of the databases/ folder is empty & my python includes the core dependencies: dateutil & lxml
(pip install -r requirements.txt)
https://github.com/sahana/eden/blob/master/requirements.txt

however, it doesn't work (no prepopulated data at all after web2py restarted)

Did you see any error message?

I do see an error when trying the IFRC template, not currently sure why, as Field is in the default environment:
Traceback (most recent call last):
  File "/home/fboon/code/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "applications/eden/models/zzz_1st_run.py", line 200, in <module>
    s3db.load_all_models()
  File "/home/fboon/code/web2py/applications/eden/modules/s3/s3model.py", line 422, in load_all_models
    cls.load(name)
  File "/home/fboon/code/web2py/applications/eden/modules/s3/s3model.py", line 390, in load
    model(name)
  File "/home/fboon/code/web2py/applications/eden/modules/s3/s3model.py", line 119, in __init__
    env = self.model()
  File "/home/fboon/code/web2py/applications/eden/modules/templates/IFRC/po.py", line 71, in model
    Field("name",
NameError: name 'Field' is not defined
Reply all
Reply to author
Forward
0 new messages