Giter VIP home page Giter VIP logo

flask-gunicorn's Introduction

Flask-Gunicorn

Flask-Gunicorn lets you simply run your Flask Application using the gunicorn application server easily from the command line.

Unfortunately Gunicorn doesn't work on Windows machines, so you may want to look into alternative solutions for serving your application.

Installation

Install the extension with pip:

$ pip install flask-gunicorn

Usage

Once installed, Flask-Gunicorn automatically overides the run command in the flask command line tool.

To use, simply let flask know where your application is by setting an environment variable:

export FLASK_APP=myapp.py

Then run the server:

flask run

By default Flask-Gunicorn will make a sensible guess at how many workers to allocate to the application server based the number of CPU cores on your machine, but this can be specified using the --workers x argument or WORKERS environment variable.

the flask run command also takes serveral optional arguments to help you customize your gunicorn server.

Argument Description
--workers How many workers should Gunicorn spawn
--worker_class Should Gunicorn use a specific class of worker? E.g. gevent
--debugger Run the server with the interactive debugger
--no-debugger Turn off the debugger mode
--host What address should the server bind to (e.g. 127.0.0.1)
--port What port should be used (e.g. 5000)
--reload Turn on the reloader (gunicorn will notice changes to code and restart if noticed) This is on by default in debug mode.
--noreload Turn off the reloader

Contributing

Contributions will be gleefully received! Check out the current issues, or feel free to crate new issues for any problems you've encountered and we'll push this little project forwards.

Thanks to Flask-Common and the Gunicorn Docs on Custom Applications for hints on getting this all working.

flask-gunicorn's People

Contributors

doobeh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.