9đź‘Ť
Gunicorn is a very solid project, I hope they build it out someday with multiple port binding and command line switch to indicate SSL precedence.
When you finally get in production, you’ll want to use the superior load balancing of Apache or Nginx.
But nothing prevents you (during development) from running some workers bound to port 80 and some workers bound to port 443 with keyfile and certfile set. You could then write the login link as an “absolute” url e.g. href=”https://yoursite/login” after the login, they’d be using https urls.
#!/bin/sh
# put 8 workers as Daemon listening for HTTPS on 443
gunicorn -D -w 8 --certfile=/Projects/thebodyofchrist.us.crt --keyfile=/Projects/thebodyofchrist.us.key bodyofchrist.wsgi -b 0.0.0.0:443
# put 2 workers as Daemon listening for HTTP on port 80
gunicorn -D -w 2 bodyofchrist.wsgi -b 0.0.0.0:80
2đź‘Ť
Multiple addresses can be bound. ex.:
gunicorn -b 127.0.0.1:8000 -b [::1]:8000 test:app
https://docs.gunicorn.org/en/stable/settings.html?highlight=bind#server-socket
so you can do this
gunicorn -b :80 -b :443 test:app
- How to call ipdb when a test fails in django testing?
- What became available_attrs on Django 3?
- Can django-tastypie display a different set of fields in the list and detail views of a single resource?
- Serving static files with Nginx + Gunicorn + Django
- JSON data convert to the django model
0đź‘Ť
I would do this with a reverse proxy webservice not directly with uvicorn. So Trafaek and nginx come to mind.
- User authentication via ssl certs in django
- Django query how to write: WHERE field LIKE '10__8__0__'?
- Why can I connect to http://127.0.0.1:8000/ but not to http://192.168.1.6/
- Is it possible to use django_compressor/S3/gzip?