grid_tutorial 404 in basic_grid

68 views
Skip to first unread message

Erich Meyer

unread,
Aug 18, 2022, 9:04:43 AM8/18/22
to py4web
Hello

I am working my way through the grid_tutorial  by Jim Steil. At the end of Basic Example I get the error message 404 NOT FOUND basic_grid  when I call 127.0.0.1:8000/basic_grid.


controllers.py :

-----------------------------------------------------------------
from .common import unauthenticated, action, session, db, GRID_DEFAULTS
from py4web.utils.form import Form, FormStyleBulma
from py4web.utils.grid import Grid, GridClassStyleBulma

@unauthenticated("index", "index.html")
def index():
    return dict()

@action("basic_grid", method=["POST", "GET"])
@action("basic_grid/<path:path>", method=["POST", "GET"])
@action.uses( session, db, "grid.html")
def basic_grid():
    grid = Grid( path, db.district,  **GRID_DEFAULTS )
    return dict(grid=grid)
---------------------------------------------------------------------------------    
However, this error is not displayed in the dashboard. Now I do not know what to do.

Erich

Massimo DiPierro

unread,
Aug 18, 2022, 10:33:36 AM8/18/22
to Erich Meyer, py4web
i think the URL misses the app name


--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/97aab171-e4e7-473a-a3e1-94055973ee88n%40googlegroups.com.

Jim Steil

unread,
Aug 18, 2022, 10:34:31 AM8/18/22
to py4web
Let me review my tutorial

I can see that the @action.uses is incorrect, the format has changed.

it should be

@action.uses('grid.html', sessions, db)

...in that order 

I'll get back....

Maurice Waka

unread,
Aug 18, 2022, 10:44:17 AM8/18/22
to Jim Steil, py4web
You need to add the app name.

Also to add some discussion, 

Don't we need only :
@action("basic_grid/<path:path>", method=["POST", "GET"])

Instead of both decorations:

@action("basic_grid", method=["POST", "GET"])
@action("basic_grid/<path:path>", method=["POST", "GET"])

For me only using this works:

@action("basic_grid/<path:path>", method=["POST", "GET"])


--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.

Jim Steil

unread,
Aug 18, 2022, 10:46:36 AM8/18/22
to py4web
Massimo is correct.  I've updated the grid tutorial with the proper URL.

Sorry for the inconvenience.  I'm reviewing the other pages to fix template location and verify links.  Let me know if you see anything else funny.

Jim Steil

unread,
Aug 18, 2022, 10:48:20 AM8/18/22
to py4web
@maurice

I've never tried that, I've always listed both.   Massimo, do we need both @action declarations for grid controller methods?

-Jim

mauri...@gmail.com

unread,
Aug 19, 2022, 10:32:06 AM8/19/22
to py4web
I created a new app with only one (with the <path:path>)and find it working locally.

mauri...@gmail.com

unread,
Aug 19, 2022, 10:37:17 AM8/19/22
to py4web
Sorry...continuation...
After re-look on my code , yes its a little different but I used it as:

@action('item/<path:path>', method=["GET", "POST"])
@action.uses('item_folder/item.html')

I reacted to the code above with these difference in my mind while not actually looking at the difference then.
Kind regards

Reply all
Reply to author
Forward
0 new messages