Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/graup/flask-restless-security

Concise skeleton for development of Flask, Flask-Restless, SQLAlchemy, JWT based REST APIs.
https://github.com/graup/flask-restless-security

flask flask-security jwt python sqlalchemy

Last synced: about 2 months ago
JSON representation

Concise skeleton for development of Flask, Flask-Restless, SQLAlchemy, JWT based REST APIs.

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/graup/flask-restless-security.svg?branch=master)](https://travis-ci.org/graup/flask-restless-security)

This is a starting point for a [Flask](http://flask.pocoo.org/) website + API using:

- [Flask-Restless](https://flask-restless.readthedocs.org/en/latest/) (API)
- [Flask-Security](https://pythonhosted.org/Flask-Security/) (Authentication)
- [Flask-JWT](https://pythonhosted.org/Flask-JWT/) (API authentication)
- [Flask-Admin](http://flask-admin.readthedocs.org/en/latest/) (Admin views)
- [SQLAlchemy](http://www.sqlalchemy.org/) (ORM)

Plus stubs for

- Templates
- Testing

I got the basic idea from Nic:
http://stackoverflow.com/a/24258886/700283

The goal here is simple code. You can read through everything in a short time
and get a good idea of how you could put these pieces together.

Setup
=====

- Create and activate a vitualenv
- Run `pip install -r requirements.txt`
- Start server using `python server.py`

**Website**

- Access site at /. Not much there, just a basic example for logging in

**Admin**

- Access admin at /admin

**API auth**

- POST /api/v1/auth {'username': '', 'password': ''}
- Returns JSON with {'access_token':''}
- Then request from API using header 'Authorization: JWT $token'

**Tests**

- Run tests using `python test.py`