I'm calling from external cron, which is why this option is not getting set.
So all I have to do is add --cronjob to my cron line and it's all set.
Alternatively, while trying to figure this problem out, I noticed that
global_settings.cmd_options.shell will return a string if run from the
shell, or None if run as a web request, so if I didn't want to (or couldn't)
add --cronjob to my script, then I could replace what I used earlier with
this:
############ FORCED SSL #############
from gluon.settings import global_settings
if global_settings.cmd_options.shell:
print 'Running as shell script.'
elif not request.is_https:
session.secure()
redirect('https://%s/%s' % (request.env.http_host, request.application))
#####################################
So I guess it's personal preference as to whether you would want to add
--cronjob or check global_settings.cmd_options.shell. Thanks for the help!