Skip to content

Commit 40b5792

Browse files
committed
add suggestions on env vs dev environment
- suggestion to rename DJANGO_DEBUG_FALSE - suggest using non-privileged user in Docker - mentioning explicitly the dev environment does not rely on Docker - add reminder to commit changes made to Dockerfile too
1 parent cddcf3b commit 40b5792

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

chapter_10_production_readiness.asciidoc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ else:
288288
SECRET_KEY = "insecure-key-for-dev"
289289
----
290290
====
291+
// CSANAD: I think variable names like "something_false" are confusing, since
292+
// we need to set something to true so that they mean false.
293+
// How about `DJANGO_ENV_PRODUCTION` or something similar?
291294

292295
<1> We say we'll use an environment variable called `DJANGO_DEBUG_FALSE`
293296
to switch debug mode off, and in effect require production settings
@@ -308,6 +311,14 @@ against accidentally forgetting to set one.
308311
TIP: Better to fail hard than allow a typo in an environment variable name to
309312
leave you running with insecure settings.
310313

314+
// CSANAD: I think it would worth pointing out the development environment
315+
// does not use Docker, launching the dev server should be done from
316+
// the reader's host system. I think this isn't immediately obvious, e.g. I
317+
// thought all along that from now on we would only run the server from Docker.
318+
// If we end up making a TIP or similar about it, I think we should also mention
319+
// in a development environment relying on containerization, programmers usually
320+
// mount the whole /src minimizing the time-consuming rebuilding of their images.
321+
311322
==== Setting environment variables inside the Dockerfile
312323

313324
Now let's set that environment variable in our Dockerfile using the `ENV` directive:
@@ -489,6 +500,7 @@ ENV DJANGO_DEBUG_FALSE=1
489500
CMD gunicorn --bind :8888 superlists.wsgi:application
490501
----
491502
====
503+
// CSANAD: I think it would be important to use a non-privileged user in Docker
492504

493505
Well, it was fiddly, but that should get us to passing tests!
494506

@@ -632,7 +644,7 @@ django.db.utils.OperationalError: no such table: lists_list
632644

633645
Re-create the datase with `./src/manage.py migrate` and we'll be back to a working state.
634646

635-
Don't forget to commit our changes to _settings.py_,
647+
Don't forget to commit our changes to _settings.py_ and _Dockerfile_,
636648
and I think we can call it job done!
637649
We've at least touched on many or most of the things you might need to think about
638650
when considering production-readiness,

0 commit comments

Comments
 (0)