-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ynr/settings: add containerised local.py example
- Loading branch information
1 parent
de5e27e
commit f39e792
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Only set DEBUG to True in development environments. | ||
DEBUG = True | ||
|
||
# This short, known value is insecure. | ||
SECRET_KEY = "development" | ||
|
||
# Certain errors are very noisy (obscuring the real problem) if this list is | ||
# empty. | ||
ADMINS = [("Dummy Admin", "[email protected]")] | ||
|
||
# This permits the site to be served at localhost:8080. | ||
ALLOWED_HOSTS = ['*'] | ||
|
||
# This unpleasantness adds the container's internal IP to the list of those IPs | ||
# permitted to access the Django debug toolbar, which allows it to be enabled. | ||
# We believe the container's own IP needs to be in this list because of | ||
# something to do with the container networking, or the HTTP server gunicorn's | ||
# reverse-proxy setup, or both. | ||
# TODO: Replace with a better method, either here or by changing the | ||
# container/gunicorn setup. https://pypi.org/project/netifaces/ also exists, | ||
# but might not be considered "better". | ||
import socket | ||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
s.connect(("8.8.8.8", 80)) | ||
INTERNAL_IPS = [ '127.0.0.1', str(s.getsockname()[0]) ] | ||
s.close() |