Skip to content

nezaj/flask-api-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask API Skeleton

Flask API Skeleton provides a bare-bones structure for a simple Flask API app.

Quickstart

Because sometimes you just want to see it work

git clone git@github.com:nezaj/flask-api-skeleton.git
cd flask-api-skeleton
sudo pip install virtualenv
make virtualenv
source ~/.virtualenvs/flask-api-skeleton/bin/activate
./manage.py runserver

Now go to http://localhost:5000/ in your favorite browser. Huzzah!

Installing

You should build a virtualenv to contain this project's Python dependencies. The Makefile will create one for you and put it in ~/.virtualenvs/flask-api-skeleton.

sudo pip install virtualenv
make virtualenv

Then activate it:

source ~/.virtualenvs/flask-api-skeleton/bin/activate

Instead of activating it manually like that, you might find it convenient to use virtualenvwrapper for working with virtualenvs:

sudo pip install virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh
workon flask-api-skeleton

If you ever need to upgrade it or install packages which appeared since your last run, just run make virtualenv again.

Running

You can run the app using Flask's built-in Werkzeug development server via

./manage.py runserver

You may also specify the port and host like so:

./manage.py runserver --port=8080 --host=0.0.0.0  # listening on port 8080 to requests coming from any source

By default, the app runs using the DevelopmentConfig configuration defined in the settings module. To point to a different configuration module, you can set the CONFIG_ENV variable:

CONFIG_ENV=test ./manage.py runserver

Tests

The environment is preconfigured to contain pep8 and pylint, popular Python static analysis tools. pytest and webtest are also used for automated testing. You can run all the tests via make check

About

Bare-bones skeleton for building APIs w/ Flask

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published