Skip to content

robertoachar/python-flask-seed

Repository files navigation

Python Flask Seed

License

A python with flask seed project.

Dependencies

$ pip3 install flask

Development

# clone the repository
$ git clone https://github.com/robertoachar/python-flask-seed.git

# change the directory
$ cd python-flask-seed

# run
$ python3 -m python_flask_seed

# output from flask
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

Usage

Hello

Request

GET / HTTP/1.1
Host: localhost:5000

Response

200 OK
{
  "message": "Hello from flask!"
}

Welcome

Request

POST /welcome HTTP/1.1
Host: localhost:5000

{
  "name": "Roberto"
}

Response

200 OK
{
  "message": "Hello Roberto!"
}

Error handling

400 BAD REQUEST
{
  "error": "name is required"
}

Not found

Request

[GET, POST] /not_found HTTP/1.1
Host: localhost:5000

Error handling

404 NOT FOUND
{
  "error": "route not found"
}

Tests

Install dependencies

$ npm install

Run tests

$ npm test

VSCode

Install extension Python 0.7.0 from Don Jayamanne

ext install python

Install extension dependencies

# install autopep8
$ pip install autopep8

# install pylint
$ pip install pylint

Set python path

File > Preferences > Settings > User Settings

{
  "python.pythonPath": "C:\\Python35"
}

Author

Roberto Achar

License

MIT