-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec5db1e
commit d517d98
Showing
2 changed files
with
34 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,7 @@ server metrics. | |
and ``[email protected]`` bases. | ||
|
||
The Django extension supports both synchronous and asynchronous | ||
Gunicorn workers. If you want asynchronous workers, you have to add | ||
the ``gevent`` package to the ``requirements.txt`` file. | ||
Read more | ||
:ref:`Using asynchronous Gunicorn workers <django-async-gunicorn-workers>`. | ||
Gunicorn workers. | ||
|
||
Project requirements | ||
==================== | ||
|
@@ -35,6 +32,12 @@ There are 2 requirements to be able to use the ``django-framework`` extension: | |
``./<Rock name with - replaced by _>/<Rock name with - replaced by _>/manage.py`` | ||
relative to the ``rockcraft.yaml`` file. | ||
|
||
For the project to make use of asynchronous Gunicorn workers: | ||
|
||
- The ``requirements.txt`` file must include ``gevent`` as a dependency. | ||
|
||
Read more | ||
:ref:`Gunicorn worker selection <django-gunicorn-worker-selection>`. | ||
|
||
``parts`` > ``django-framework/dependencies:`` > ``stage-packages`` | ||
=================================================================== | ||
|
@@ -50,26 +53,23 @@ application. In the following example we use it to specify ``libpq-dev``: | |
# list required packages or slices for your Django application below. | ||
- libpq-dev | ||
.. _django-async-gunicorn-workers: | ||
.. _django-gunicorn-worker-selection: | ||
|
||
Using asynchronous Gunicorn workers | ||
=================================== | ||
Gunicorn worker selection | ||
========================= | ||
|
||
If you want to use asynchronous workers, you have to add the ``gevent`` package | ||
to the ``requirements.txt`` file. Rockcraft automatically detects this and | ||
updates the Pebble plan to use the asynchronous workers. If you have ``gevent`` | ||
installed in your rock but decided to use ``sync`` workers instead you can do | ||
so by using the ``--args`` parameter of ``docker run``: | ||
If the project has gevent as a dependency, Rockcraft automatically updates the | ||
pebble plan to spawn asynchronous Gunicorn workers. | ||
|
||
When the project instead needs synchronous workers, you can override the worker | ||
type by adding ``--args django sync`` to the Docker command that launches the | ||
rock: | ||
|
||
.. code-block:: bash | ||
docker run --name django-container -d -p 8000:8000 django-image:1.0 \ | ||
--args django sync | ||
.. note:: | ||
The Django extension is compatible with the ``bare``, ``[email protected]`` and | ||
``[email protected]`` bases. | ||
|
||
Useful links | ||
============ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,7 @@ server metrics. | |
and ``[email protected]`` bases. | ||
|
||
The Flask extension supports both synchronous and asynchronous | ||
Gunicorn workers. If you want asynchronous workers, you have to add | ||
``gevent`` package to the ``requirements.txt`` file. | ||
Read more | ||
:ref:`Using asynchronous Gunicorn workers <flask-async-gunicorn-workers>`. | ||
Gunicorn workers. | ||
|
||
Project requirements | ||
==================== | ||
|
@@ -31,7 +28,14 @@ There are 2 requirements to be able to use the ``flask-framework`` extension: | |
``Flask`` declared as a dependency | ||
2. The project must include a WSGI app with the path ``app:app``. This means | ||
there must be an ``app.py`` file at the root of the project with the name | ||
of the Flask object is set to ``app`` | ||
of the Flask object is set to ``app``. | ||
|
||
For the project to make use of asynchronous Gunicorn workers: | ||
|
||
- The ``requirements.txt`` file must include ``gevent`` as a dependency. | ||
|
||
Read more | ||
:ref:`Gunicorn worker selection <flask-gunicorn-worker-selection>`. | ||
|
||
``parts`` > ``flask-framework/dependencies`` > ``stage-packages`` | ||
================================================================= | ||
|
@@ -47,17 +51,17 @@ application. In the following example we use it to specify ``libpq-dev``: | |
# list required packages or slices for your flask app below. | ||
- libpq-dev | ||
.. _flask-async-gunicorn-workers: | ||
.. _flask-gunicorn-worker-selection: | ||
|
||
Gunicorn worker selection | ||
========================= | ||
|
||
Using asynchronous Gunicorn workers | ||
=================================== | ||
If the project has gevent as a dependency, Rockcraft automatically updates the | ||
pebble plan to spawn asynchronous Gunicorn workers. | ||
|
||
If you want to use asynchronous workers, you have to add ``gevent`` package to | ||
the ``requirements.txt`` file. Rockcraft automatically detects this and updates | ||
the pebble plan to use the asynchronous workers. If you have ``gevent`` | ||
installed in your rock but decided to use ``sync`` workers instead you can use | ||
the ``--args`` parameter of ``docker run`` to use ``sync`` workers instead of | ||
the default ``gevent``: | ||
When the project instead needs synchronous workers, you can override the worker | ||
type by adding ``--args flask sync`` to the Docker command that launches the | ||
rock: | ||
|
||
.. code-block:: bash | ||
|