mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #34140 -- Reformatted code blocks in docs with blacken-docs.
This commit is contained in:
committed by
Mariusz Felisiak
parent
6015bab80e
commit
14459f80ee
@@ -69,4 +69,5 @@ To apply ASGI middleware, or to embed Django in another ASGI application, you
|
||||
can wrap Django's ``application`` object in the ``asgi.py`` file. For example::
|
||||
|
||||
from some_asgi_library import AmazingMiddleware
|
||||
|
||||
application = AmazingMiddleware(application)
|
||||
|
||||
@@ -52,19 +52,21 @@ Instead of hardcoding the secret key in your settings module, consider loading
|
||||
it from an environment variable::
|
||||
|
||||
import os
|
||||
SECRET_KEY = os.environ['SECRET_KEY']
|
||||
|
||||
SECRET_KEY = os.environ["SECRET_KEY"]
|
||||
|
||||
or from a file::
|
||||
|
||||
with open('/etc/secret_key.txt') as f:
|
||||
with open("/etc/secret_key.txt") as f:
|
||||
SECRET_KEY = f.read().strip()
|
||||
|
||||
If rotating secret keys, you may use :setting:`SECRET_KEY_FALLBACKS`::
|
||||
|
||||
import os
|
||||
SECRET_KEY = os.environ['CURRENT_SECRET_KEY']
|
||||
|
||||
SECRET_KEY = os.environ["CURRENT_SECRET_KEY"]
|
||||
SECRET_KEY_FALLBACKS = [
|
||||
os.environ['OLD_SECRET_KEY'],
|
||||
os.environ["OLD_SECRET_KEY"],
|
||||
]
|
||||
|
||||
Ensure that old secret keys are removed from ``SECRET_KEY_FALLBACKS`` in a
|
||||
|
||||
@@ -84,11 +84,12 @@ function::
|
||||
|
||||
import os
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "mysite.settings"
|
||||
|
||||
from django.contrib.auth.handlers.modwsgi import check_password
|
||||
|
||||
from django.core.handlers.wsgi import WSGIHandler
|
||||
|
||||
application = WSGIHandler()
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ object. For instance you could add these lines at the bottom of
|
||||
:file:`wsgi.py`::
|
||||
|
||||
from helloworld.wsgi import HelloWorldApplication
|
||||
|
||||
application = HelloWorldApplication(application)
|
||||
|
||||
You could also replace the Django WSGI application with a custom WSGI
|
||||
|
||||
Reference in New Issue
Block a user