Simple Rest API flask template, to start build API.
-
Cloning this repository.
$ git clone https://github.com/Kaspary/simple-flask-api-template.git
-
Creating and activate a python virtual environment, with your favorite tool.
$ virtualenv env && source env/bin/activate
-
Install all dependencies.
$ pip install -r requirements.txt
-
Creating a file named
.env
, into the project (usingexample.env
as example). -
Run project
$ flask run
- Run migration to create database schema.
$ flask db init
- flask user create: Create new user;
Examples:
$ flask user create my_user
$ flask user create my_admin_user --admin
$ flask user create my_new_user --auto-pass
- flask user list: List all users:
- Example:
$ flask user list
- flask user delete: Delete a user by id;
- Example:
$ flask user delete 1
- flask user activation: Set a user as active by id;
- Example:
$ flask user activation 1
- flask user newpassword: Set new password to user by id.
- Example:
$ flask user newpassword 1
$ flask user newpassword 1 --auto-pass
- --admin: Set user as admin on
create
command;$ flask user create my_user --admin
- --auto-pass: Using to generete a random pass on
newpassword
orcreate
command.$ flask user create my_user --auto-pass
After instalation, run this command:
$ flask run
Access API on http://127.0.0.1:5000
.
To understed how to using the API, access http://127.0.0.1:5000/documentation
.
Postman collection is accessible on http://127.0.0.1:5000/documentation/postman
.
Web Documentation is generatig using Docgen project.