项目作者: fuzzy69

项目描述 :
KITTI Flask demo application
高级语言: Python
项目地址: git://github.com/fuzzy69/flaskapp.git
创建时间: 2019-11-20T07:27:51Z
项目社区:https://github.com/fuzzy69/flaskapp

开源协议:

下载


KITTI Flask demo application

Screenshot

Screenshot

Requirements

  • python (>=3.5)
  • Flask
  • Pandas
  • PyTables

Project Structure

  • kittiproject
    — dataset (KITTI dataset files)
    — flaskapp (Flask application)
    —- application (Core application and template files)
    —- data (KITTI data storage files)
    —- logs (Flask application log files)
    —- static (CSS and JavaScript files)
    —- config.py (Flask app configuration)
    —- main.py (Main entry point)
    —- run (Run app script)
    — migration (imports KITTI data to a H5 file)

Installation

Navigate to project directory.
Optionally install virtual environment with:

  1. virtualenv env -p python3

Start virtual environment with:

  1. . env/bin/activate

Install required Python libraries with:

  1. pip install -r requirements.txt

Configuration

Make sure that appropriate port (default one is 4000) is free before running the application. You can change the port in PROJECT_DIR/config.py file by changing the PORT constant.
Set Flask secret key

  1. export FLASKAPP_KEY=demo

Usage

From the project directory execute:

  1. ./run

or

  1. python3 main.py

Open http://localhost:4000/ or http://127.0.0.1:4000/ in your web browser.

Credentials

username: demo
password: demo

API

API key: demo:ZGVtb3Rva2Vu

Endpoint: /api

  1. curl --request GET \
  2. --url 'http://localhost:4000/api/'

Response:

  1. {
  2. "message": string,
  3. "status": bool,
  4. "version": string
  5. }

Endpoint (requires authentication): /api/oxts

  1. curl --request GET \
  2. --url 'http://localhost:4000/api/oxts' \
  3. --header 'authorization: Bearer demo:ZGVtb3Rva2Vu'

Response:

  1. {
  2. "data": {
  3. "oxts": list[dict],
  4. "total_pages": int
  5. },
  6. "status": bool
  7. }

Endpoint with filter (requires authentication): /api/oxts?timestamp=2011-10-03%2014%3A34%3A34.102597

  1. curl --request GET \
  2. --url 'http://localhost:4000/api/oxts?timestamp=2011-10-03%2014%3A34%3A34.102597' \
  3. --header 'authorization: Bearer demo:ZGVtb3Rva2Vu'

Unit tests

From the flaskapp directory execute:

  1. python -m unittest discover tests -v

or just

  1. make test