You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Web2py新手求助:如何通过appadmin创建manager用户组

Solution for Creating "manager" Group in Web2py Appadmin

Hey there! I totally get how frustrating it is when you're following the docs and can't find the exact step you need—been there with Web2py's appadmin more times than I'd admit 😅 Let's break this down simply:

Step 1: Access the Auth Tables in Appadmin

Appadmin doesn't have a dedicated "group creation" UI, but you can directly interact with Web2py's built-in auth database tables:

  • Open your app's appadmin interface (e.g., http://localhost:8000/your_app_name/appadmin)
  • Scroll down to the Database section, and select your app's database (usually db.sqlite for default setups)
  • Look for the auth_group table in the list of tables—this is where all user groups are stored.

Step 2: Create the "manager" Group

  • Click the insert link next to auth_group
  • In the form that pops up:
    • Fill the role field with manager (this is the group name the system will recognize)
    • Add an optional description (like "Application admin group") to keep things organized
  • Hit the submit button, and your manager group is now created!

Step 3: Add Users to the "manager" Group

  • Go back to the database table list, find the auth_membership table (this links users to groups)
  • Click insert here, then:
    • Select the target user from the user_id dropdown
    • Select your newly created manager group from the group_id dropdown
  • Submit the form, and that user is now part of the manager group.

Quick Alternative: Use Web2py Shell (Faster for Testing)

If you want a quicker way (great for debugging), you can use the Web2py shell:

  • Open your terminal, navigate to your Web2py root folder
  • Run this command to enter your app's shell:
    python web2py.py -S your_app_name -M
    
  • Then run these lines to create the group and add a user (replace USER_ID with the actual user's ID):
    # Create manager group
    manager_group_id = db.auth_group.insert(role='manager', description='Application managers')
    # Add user to group (replace USER_ID with the user's id from auth_user table)
    db.auth_membership.insert(user_id=USER_ID, group_id=manager_group_id)
    # Commit the changes
    db.commit()
    

The official docs are solid, but here are some other great resources:

  • The Web2py Cookbook has in-depth sections on authentication and group management that go beyond the overview
  • Web2py's official community forum has tons of beginner-friendly threads where you can ask specific questions
  • The official Web2py YouTube channel has short, practical tutorials that walk through auth setup step-by-step

内容的提问来源于stack exchange,提问作者Mubarak Awal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 06:55:54