Skip to content
Snippets Groups Projects
Unverified Commit fe029af6 authored by Casey's avatar Casey Committed by GitHub
Browse files

Merge pull request #785 from heroku/update-readme

Update readme
parents dd8fe58d a979d57a
No related branches found
No related tags found
No related merge requests found
......@@ -4,36 +4,54 @@
[![Build Status](https://travis-ci.org/heroku/heroku-buildpack-python.svg?branch=master)](https://travis-ci.org/heroku/heroku-buildpack-python)
This is the official [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [Pipenv](http://docs.pipenv.org/), [pip](https://pip.pypa.io/) and other excellent software.
This is the official [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) for Python apps.
Recommended web frameworks include **Django** and **Flask**. The recommended webserver is **Gunicorn**. There are no restrictions around what software can be used (as long as it's pip-installable). Web processes must bind to `$PORT`, and only the HTTP protocol is permitted for incoming connections.
Recommended web frameworks include **Django** and **Flask**, among others. The recommended webserver is **Gunicorn**. There are no restrictions around what software can be used (as long as it's pip-installable). Web processes must bind to `$PORT`, and only the HTTP protocol is permitted for incoming connections.
Python packages with C dependencies that are not [available on the stack image](https://devcenter.heroku.com/articles/stack-packages) are generally not supported, unless `manylinux` wheels are provided by the package maintainers (common). For recommended solutions, check out [this article](https://devcenter.heroku.com/articles/python-c-deps) for more information.
Python packages with C dependencies that are not [available on the stack image](https://devcenter.heroku.com/articles/stack-packages) are generally not supported, unless `manylinux` wheels are provided by the package maintainers (common). For recommended solutions, check out [this article](https://devcenter.heroku.com/articles/python-c-deps) for more information.
See it in Action
----------------
```
$ ls
my-application requirements.txt runtime.txt
$ git push heroku master
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 276 bytes | 276.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.7.1
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting flask (from -r /tmp/build_c2c067ef79ff14c9bf1aed6796f9ed1f/requirements.txt (line 1))
remote: Downloading ...
remote: Installing collected packages: Werkzeug, click, MarkupSafe, Jinja2, itsdangerous, flask
remote: Successfully installed Jinja2-2.10 MarkupSafe-1.1.0 Werkzeug-0.14.1 click-7.0 flask-1.0.2 itsdangerous-1.1.0
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote:
```
Deploying a Python application couldn't be easier:
A `requirements.txt` must be present at the root of your application's repository to deploy.
$ ls
Pipfile Pipfile.lock Procfile web.py
To specify your python version, you also need a `runtime.txt` file - unless you are using the default Python runtime version.
$ heroku create --buildpack heroku/python
Current default Python Runtime: Python 3.6.7
$ git push heroku master
-----> Python app detected
-----> Installing python-3.6.6
-----> Installing pip
-----> Installing requirements with Pipenv 2018.5.18…
...
Installing dependencies from Pipfile…
-----> Discovering process types
Procfile declares types -> (none)
Alternatively, you can provide a `setup.py` file, or a `Pipfile`. Using `Pipenv` will generate `runtime.txt` based on `python-version` at build time.
A `Pipfile` or `requirements.txt` must be present at the root of your application's repository.
Specify a Buildpack Version
---------------------------
You can also specify the latest production release of this buildpack for upcoming builds of an existing application:
You can specify the latest production release of this buildpack for upcoming builds of an existing application:
$ heroku buildpacks:set heroku/python
......@@ -41,25 +59,10 @@ You can also specify the latest production release of this buildpack for upcomin
Specify a Python Runtime
------------------------
Specific versions of the Python runtime can be specified in your `Pipfile`:
[requires]
python_version = "2.7"
Or, more specifically:
[requires]
python_full_version = "2.7.15"
Or, with a `runtime.txt` file:
$ cat runtime.txt
python-2.7.15
Runtime options include:
Supported runtime options include:
- `python-3.7.0`
- `python-3.6.6`
- `python-3.7.1`
- `python-3.6.7`
- `python-2.7.15`
## Tests
......@@ -82,4 +85,4 @@ make test-heroku-16
The tests are run via the vendored
[shunit2](https://github.com/kward/shunit2)
test framework.
\ No newline at end of file
test framework.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment