Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make urls secure on GAE using the django_wsgi builtin

I'm running Django on AppEngine (python 2.7 runtime) using their Cloud SQL. I've setup the application as described in Google's Cloud SQL docs Django Support. Everything is working great, but I want to make some of the urls secure, and I can't find any documentation on how to do that.

Normally you would just add the 'secure: always' to the handler you want secure, but as I'm not specifying the handlers/script for the app (I'm assuming the 'django_wsgi' builtin is doing that) there is no place to add the secure setting.

My app.yaml file is:

application: app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true


libraries:
- name: django
  version: "1.2"

builtins:
- django_wsgi: on
- deferred: on

handlers:
- url: /media
  static_dir: media
like image 983
punteney Avatar asked Mar 02 '12 15:03

punteney


1 Answers

The django_wsgi builtin is actually just adding the following to app.yaml:

handlers:
- url: /.*
  script: google.appengine.ext.django.main.app
  position: tail

So you can just replace the builtin-directive with this handler and add the secure-clause to the handler.

like image 181
Niko Avatar answered Oct 10 '22 03:10

Niko