Using sample Django Projects and my Django Rest Framework project, I can deploy to app engine without issue.
I can access the site via both https://myappnamehere.appspot.com and the http:// version as well.
However, I'm seemingly unable to force it to only allow HTTPS.
Attempt 1: In my Django settings, I try to set :
SECURE_SSL_REDIRECT = True
This ends with my project no longer showing up on app engine, with AppEngine reporting that I should try again in 30 minutes
Attempt 2: In app.yaml, I follow the advice from here and other stack overflow threads by adding this:
handlers:
- url: /*
script: myapplication.wsgi.application
This also ended up with the routing seemingly messed up, and all my URLs no longer routed thru the django router as expected.
What is inside the wsgi: import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapplication.settings.settings")
application = get_wsgi_application()
Attempt 3: Sorry, I forgot to mention I tried it with secure always, and it ends up with my site being unable to load again as well.
handlers:
- url: /*
script: myapplication.wsgi.application
secure: always
Just add a secure parameter to the app.yaml file.
handlers:
- url: /*
script: anyfile.py
secure: always
See Configuring Secure URLs in app.yaml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With