Help talk:Toolforge/Web/Archives/2017
Appearance
Latest comment: 7 years ago by BryanDavis in topic Creating a virtual environment for a Python app
![]() |
Please do not post any new comments on this page. This is a discussion archive See current discussion or the archives index. |
Redirecting http to https
What is the best way to redirect all traffic to https? I have tried the following but it results in an infinite loop:
$HTTP["scheme"] == "http" { $HTTP["host"] =~ ".*" { url.redirect = (".*" => "https://%0$0") } }
Thanks,
Sam Wilson 06:19, 13 February 2017 (UTC)
- I believe this is impossible with
~/.lighttpd.conf
alone. I looked at a similar question and the source code of the suggested solutionmod_extforward
, but after adding:
server.modules += ( "mod_extforward" ) extforward.forwarder = ( "all" => "trust")
- to
~/.lighttpd.conf
$HTTP['scheme']
still always washttp
. So we would have to write our ownlighttpd
module which we probably won't do :-).
- The bigger picture of making Tool Labs
https
-only is tracked as phab:T102367, and it's probably best to solve this there globally. --Tim Landscheidt (talk) 10:11, 13 February 2017 (UTC)
- @Tim Landscheidt: Hmm, bother! Ah well, it's a shame it can't be done in .lighttpd.conf, but as you say it's something that will be solved globally (at some point). In the meantime I'm doing this: https://github.com/wikisource/ia-upload/commit/66c62dfafb10d82797974a8fd6e394d6b3106d4a (based on code in video2commons). I might add a note to this page about how to do this.
- Sam Wilson 10:29, 13 February 2017 (UTC)
Creating a virtual environment for a Python app
python3 -m venv ~/www/python/venv
Does not seem to work, see also https://phabricator.wikimedia.org/T140103
The Phabricator task suggests instead:
virtualenv -p python3 venv
- Apparently the command needed depends on which host operating system you are using. On a Toolforge bastion you need the
virtualenv -p python3 venv
form and will end up with a Python 3.4.0 virtual environment. Inside a Kubernetes python container you need to use thepython3 -m venv ~/www/python/venv
form and will end up with a Python 3.4.2 virtual environment. --BryanDavis (talk) 19:48, 5 July 2017 (UTC)