mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Document server hooks in a custom application
This commit is contained in:
parent
5b68c17b17
commit
0f20019113
@ -16,6 +16,25 @@ a custom Application:
|
||||
:start-after: # See the NOTICE for more information
|
||||
:lines: 2-
|
||||
|
||||
Using server hooks
|
||||
------------------
|
||||
|
||||
If you wish to include server hooks in your custom application, you can specify a function in the config options. Here is an example with the `pre_fork` hook:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def pre_fork(server, worker):
|
||||
print(f"pre-fork server {server} worker {worker}", file=sys.stderr)
|
||||
|
||||
# ...
|
||||
if __name__ == '__main__':
|
||||
options = {
|
||||
'bind': '%s:%s' % ('127.0.0.1', '8080'),
|
||||
'workers': number_of_workers(),
|
||||
'pre_fork': pre_fork,
|
||||
}
|
||||
|
||||
|
||||
Direct Usage of Existing WSGI Apps
|
||||
----------------------------------
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user