django-pyuwsgi
Run pyuwsgi (aka uWSGI) as a Django management command.
Usage
-
Install:
pip install django-pyuwsgi -
Add to
INSTALLED_APPS:INSTALLED_APPS = [ # ... "django_pyuwsgi", # ... ]
-
Run:
manage.py pyuwsgi --socket=:8000 ...
Configuration
Pyuwsgi already knows the Python interpreter and virtualenv (if applicable) to use from the Django management command environment. By default, it will run with the following flags (using settings.WSGI_APPLICATION to determine the module):
--strict --need-app --module={derived}
If you have STATIC_URL defined with a local URL, it will also add --static-map, derived from STATIC_URL and STATIC_ROOT.
You can pass any additional arguments uWSGI accepts in from the command line.
But uWSGI has a lot of flags, and many of them, you want every time you run the project. For that scenario, you can configure your own defaults using the optional setting, PYUWSGI_ARGS. Here's an example you might find helpful:
PYUWSGI_ARGS = [
"--master",
"--strict",
"--need-app",
"--module".
":".join(WSGI_APPLICATION.rsplit(".", 1)),
"--no-orphans",
"--vacuum",
"--auto-procname",
"--enable-threads",
"--offload-threads=4",
"--thunder-lock",
"--static-map",
"=".join([STATIC_URL.rstrip("/"), STATIC_ROOT]),
"--static-expires",
"/* 7776000",
]
Don't forget to also set something like --socket=:8000 or --http=:8000 so your app listens on a port. Depending on your setup, it may make more sense to pass this in via the command line than hard-coding it in your settings.
Motivation
In some scenarios, it is beneficial to distribute a Django project with a single entrypoint for command-line interaction. This can come in handy when building Docker containers or self-contained Python apps with something like shiv.
Metadata
Release files for django-pyuwsgi 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-pyuwsgi-1.1.1.tar.gz | 3.9 kB | Without provenance | Details for django-pyuwsgi-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_pyuwsgi-1.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_pyuwsgi-1.1.1-py2.py3-none-any.whl |
Total release size: 9.3 kB
Release files / django-pyuwsgi-1.1.1.tar.gz
| Download URL | django-pyuwsgi-1.1.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae83b8b7caf85b299b56a6100a5a3ba3758a6d91604dbb9cedc1e7f46b21dd3e
|
|
BLAKE2b-256 checksum How to use checksums |
a74bbd750b825d455e031b3e025134c86bb1d59172bfe796d94a0ad41fe19c1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0
|
Release files / django_pyuwsgi-1.1.1-py2.py3-none-any.whl
| Download URL | django_pyuwsgi-1.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8a4413bb6f12dc5ba8031a9151f2eec5a8f77756e7ea0fb593c53b00d7a9f49e
|
|
BLAKE2b-256 checksum How to use checksums |
bab1bd98df4d2ce93b6ac22515a79aaf2f746015e0266227ca76bc09f1971fa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0
|
Security for django-pyuwsgi 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.