Create Flask Admin User
This will be a user with full admin rights to view the backend of your database. So this user should probably only be you as a solo founder / creator!
For reference you can see a full list of Flask Admin commands by running this:
flask users --help
This will generate the following output:
Usage: flask users [OPTIONS] **COMMAND** [ARGS]...
User commands.
For commands that require a USER - pass in any identity attribute.
Options:
--help Show this message and exit.
Commands:
activate Activate a user.
change_password Administratively change a user's password.
create Create a user.
deactivate Deactivate a user.
reset_access Reset all authentication credentials for user.
1. Create a new user:
(After running this command you will be prompted to create a new password).
flask users create [your-email-here]
2. Activate the user:
flask users activate [your-email-here]
3. Create an admin role. And add this role to the user you have just created:
flask roles create admin
flask roles add [your-email-here] admin
You will now use these admin credentials to log into your admin dashboard at localhost:5001/admin. (Only users with the role "admin" can do this as specified in app/admin_views.py). If you would like to learn more about this see my tutorial on securing your web app with Flask security here.
Now when you go to localhost:5001/admin and click on User on the navbar you will see your admin user entry: