{ "info": { "author": "Randall Degges", "author_email": "rdegges@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# flask-heroku-rqify\n\nAutomatic RQ configuration for your Heroku Flask applications.\n\n![Worker Sketch](https://raw.github.com/rdegges/flask-heroku-rqify/master/assets/worker-sketch.jpg)\n\n\n## Purpose\n\n[RQ](http://python-rq.org/) is a lightweight, simple, and efficient Python\nlibrary for queueing jobs and processing them in the background with workers.\nIt uses [Redis](http://redis.io/) as a back end.\n\n`flask-heroku-rqify` handles all RQ configuration for you, so that you can get\nyour application processing asynchronous tasks with only a single line of code!\n\nIn addition to make configuration easier, `flask-heroku-rqify` also allows you\nto seamlessly switch your Heroku Redis provider instantly, with no downtime. By\nanalyzing which Redis addons your Heroku application has available, and\nautomatically configuring RQ to use these addons, you can easily swap your Redis\nproviders around without touching a single line of code!\n\n\n## Install\n\nTo install `flask-heroku-rqify`, use [pip](http://pip.readthedocs.org/en/latest/).\n\n```bash\n$ pip install flask-heroku-rqify\n```\n\nNext, modify your `requirements.txt` file in your home directory, and add the\nfollowing to the bottom of your file:\n\n```bash\nFlask-Heroku-RQify>=0.1\n```\n\n\n## Pick an Addon\n\nHeroku has lots of available Redis addons. `flask-heroku-rqify` works with\nthem all! That means no matter which option you choose, your queue will work\nout of the box, guaranteed!\n\nBelow is a list of the addons you can install to get started, you should have at\nleast one of these activated on your Heroku app -- otherwise,\n`flask-heroku-rqify` will attempt to connect to your default Redis instance\nrunning locally (good for local development).\n\n- [RedisGreen](https://addons.heroku.com/redisgreen)\n- [MyRedis](https://addons.heroku.com/myredis)\n- [Redis Cloud](https://addons.heroku.com/rediscloud)\n- [Redis To Go](https://addons.heroku.com/redistogo)\n- [openredis](https://addons.heroku.com/openredis)\n\n**NOTE**: My favorite providers are openredis and RedisGreen.\n\n\n## Usage\n\nUsing `flask-heroku-rqify` is *super easy*! In your `app.py` (or wherever\nyou define your Flask application), add the following:\n\n```python\nfrom flask.ext.rqify import init_rqify\n\napp = Flask(__name__)\ninit_rqify(app)\n```\n\nTo define tasks, you can do the following:\n\n```python\nfrom flask.ext.rq import job\n\n@job\ndef process(i):\n # process stuff...\n```\n\nTo use the task defined above, you could do:\n\n```python\n>>> process.delay(2)\n```\n\nOnce you've defined your tasks, it's now time to boot up a worker process! To\ndo this, we'll use the\n[Flask-Script](http://flask-script.readthedocs.org/en/latest/) extension (which\nis installed automatically by `flask-heroku-rqify`). In your project directory,\ncreate a new file named `manage.py`, and add the following:\n\n```python\nfrom flask.ext.rq import get_worker\nfrom flask.ext.script import Manager\n\nfrom myapp import app\n\n\nmanager = Manager(app)\n\n\n@manager.command\ndef work():\n \"\"\"Process the queue.\"\"\"\n get_worker().work()\n```\n\nThen modify your `Procfile`, and add the following line:\n\n```\nworker: python manage.py work\n```\n\nNow, to start processing your tasks on your new worker, you can finally just\nspin up a new worker process using `heroku scale`:\n\n```bash\n$ heroku scale worker=1\n```\n\nIf you'd like to process your queue faster, you can add more workers at any\ntime:\n\n```bash\n$ heroku scale worker=10\n```\n\nHow does this work? In the background, `flask-heroku-rqify` is really just\nautomatically configuring the popular\n[Flask-RQ](https://flask-rq.readthedocs.org/en/latest/) extension! This means,\nyou can basically read through the [official\ndocumentation](https://flask-rq.readthedocs.org/en/latest/) to learn more about\nRQ, how it works, and how Flask-RQ works.\n\n\n## Like This?\n\nLike this software? If you really enjoy `flask-heroku-rqify`, you can show\nyour appreciation by:\n\n- Sending me some bitcoin, my address is: **166UZk46Y6sLBj2br1whB9mvzxQD2EVfUp**\n- Tipping me on [gittip](https://www.gittip.com/rdegges/).\n\nEither way, thanks! <3\n\n\n## Changelog\n\nv0.1: 04-21-2013\n\n - Pushing first release to PyPI!\n - Adding `init_rqify` handler to auto-configure Flask-RQ.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rdegges/flask-heroku-cacheify", "keywords": "flask heroku cloud cache memcache memcached redis awesome", "license": "UNLICENSE", "maintainer": null, "maintainer_email": null, "name": "Flask-Heroku-RQify", "package_url": "https://pypi.org/project/Flask-Heroku-RQify/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Flask-Heroku-RQify/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rdegges/flask-heroku-cacheify" }, "release_url": "https://pypi.org/project/Flask-Heroku-RQify/0.2/", "requires_dist": null, "requires_python": null, "summary": "Automatic RQ configuration for your Heroku Flask applications.", "version": "0.2" }, "last_serial": 784295, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "833505f8ce0487e8d63bf5816cb0fe3d", "sha256": "bed494a1afde709cb899359e714b034a6afa96eb92cf2a603057b03217e6c323" }, "downloads": -1, "filename": "Flask-Heroku-RQify-0.1.tar.gz", "has_sig": false, "md5_digest": "833505f8ce0487e8d63bf5816cb0fe3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 73415, "upload_time": "2013-04-21T22:34:53", "url": "https://files.pythonhosted.org/packages/80/08/238e87c15390be8c31e18fd7568af96f80987b6bffe0e35d03c3280380cd/Flask-Heroku-RQify-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "87d3d2d702b46dd76f6016b18bd6a291", "sha256": "ba43d479b9598830462d9a54356e0a9b080705ec9e6e31b313db3bb272dcb8d6" }, "downloads": -1, "filename": "Flask-Heroku-RQify-0.2.tar.gz", "has_sig": false, "md5_digest": "87d3d2d702b46dd76f6016b18bd6a291", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 73953, "upload_time": "2013-04-22T01:53:43", "url": "https://files.pythonhosted.org/packages/94/36/69d2c24a1305a424eb61388680d936cd1411ed427c1596f9b7547e1e7e59/Flask-Heroku-RQify-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "87d3d2d702b46dd76f6016b18bd6a291", "sha256": "ba43d479b9598830462d9a54356e0a9b080705ec9e6e31b313db3bb272dcb8d6" }, "downloads": -1, "filename": "Flask-Heroku-RQify-0.2.tar.gz", "has_sig": false, "md5_digest": "87d3d2d702b46dd76f6016b18bd6a291", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 73953, "upload_time": "2013-04-22T01:53:43", "url": "https://files.pythonhosted.org/packages/94/36/69d2c24a1305a424eb61388680d936cd1411ed427c1596f9b7547e1e7e59/Flask-Heroku-RQify-0.2.tar.gz" } ] }