Giter VIP home page Giter VIP logo

flask-command's Introduction

flask-command - A tool to use a flask+gunicorn app from the command line

flask-command is a simple tool that allows you to call your flask application from the command line after wrapping through gunicorn. This is useful if you'd like to create a console_script entry point for your flask application.

Intended Use Case

Let's assume your project is called myproject. A flask app exists or is accessible from myproject/__init__.py. The following shows how you'd use flask-command.

In a file called myproject/main.py:

from flaskcommand import flask_command
from myproject import app

main = flask_command(app)

In your setup.py file:

setup(name='myproject',
    version='0.0.1',
    description="myproject - is awesome",
    long_description="myproject - is really awesome",
    keywords='',
    author='Reuven V. Gonzales',
    author_email='[email protected]',
    packages=['myproject'],
    include_package_data=True,
    zip_safe=False,
    install_requires=[
        'flask-command',
        'flask',
    ],
    entry_points={
        'console_scripts': [
            # WITH FLASK-COMMAND YOU CAN
            # DEFINE YOUR SCRIPT HERE :-)
            'myproject-web = myproject.main:main',
        ]
    },
    classifiers=[
        'License :: OSI Approved :: MIT License',
        'Intended Audience :: Developers',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
    ],
)

Now, after installing your project you can start your flask server like this:

$ myproject-web -b 127.0.0.1:8000 -w 4 some_config_path

At this time specifying a path to a configuration file is required, but this probably won't be so in the future.

flask-command's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fashtimedotcom

flask-command's Issues

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.