Switch from hypercorn to uvicorn

This commit is contained in:
W13R 2022-03-16 18:27:05 +01:00
parent c49798a9ea
commit 7cb5e096b5
4 changed files with 11 additions and 13 deletions

View file

@ -11,7 +11,7 @@ You run a command with
--- ---
`server` - Start the server `server` - Start the server
This starts a caddy instance, hypercorn with the django application and a scheduler that automatically removes expired session data. This starts a caddy instance, uvicorn with the django application and a scheduler that automatically removes expired session data.
Log files will be written. Log files will be written.
--- ---

View file

@ -18,14 +18,9 @@ Before the actual setup, you have to satisfy the following dependencies:
### Python Packages (pip) ### Python Packages (pip)
- `django~=3.2.7` All required python packages are listed `in pip-dependencies.txt`
- `django-currentuser==0.5.3`
- `django-csp==3.7`
- `psycopg2~=2.9.1`
- `hypercorn~=0.11.2`
- `cryptography~=36.0.0` (for self-signed tls certificates)
You can install those pip-packages with the following command: You can install the required python packages with the following command:
```bash ```bash
pip install -U -r pip-dependencies.txt pip install -U -r pip-dependencies.txt
``` ```

View file

@ -50,7 +50,7 @@ print(f"HTTP Access Log will be written to {CADDY_ACCESS_LOG}")
try: try:
# start django/hypercorn # start django/uvicorn
if devel: if devel:
run( run(
@ -75,7 +75,10 @@ try:
) )
app_process = Popen( app_process = Popen(
[ [
"hypercorn", "--bind", quote(f"localhost:{DJANGO_PORT}"), "drinks_manager.asgi:application" "uvicorn",
"--host", "localhost",
"--port", quote(DJANGO_PORT),
"drinks_manager.asgi:application"
], ],
stdout=application_log_file, stdout=application_log_file,
stderr=application_log_file, stderr=application_log_file,
@ -137,7 +140,7 @@ except KeyboardInterrupt:
if devel: if devel:
print(f"Django stopped with exit code {app_process.returncode}.") print(f"Django stopped with exit code {app_process.returncode}.")
else: else:
print(f"Django/Hypercorn stopped with exit code {app_process.returncode}.") print(f"Django/Uvicorn stopped with exit code {app_process.returncode}.")
if caddy_process.returncode != 0 or scs_process.returncode != 0 or app_process.returncode !=0: if caddy_process.returncode != 0 or scs_process.returncode != 0 or app_process.returncode !=0:
exit(1) exit(1)

View file

@ -2,5 +2,5 @@ django~=3.2.7
django-currentuser==0.5.3 django-currentuser==0.5.3
django-csp==3.7 django-csp==3.7
psycopg2~=2.9.1 psycopg2~=2.9.1
hypercorn~=0.11.2 uvicorn~=0.17.6
cryptography~=36.0.0 cryptography~=36.0.0