You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you remember I said that `LiveServerTestCase` had certain limitations?
366
369
Well, one is that it always assumes you want to use its own test server,
@@ -459,17 +462,21 @@ TIP: Don't use `export` to set the 'TEST_SERVER' environment variable;
459
462
460
463
==== Making an src Folder
461
464
465
+
// DAVID: FWIW it reads weirdly to me to have 'an src' rather than 'a src'.
466
+
// It's probably because I pronounce it as 'source' rather than 'S.R.C.'
467
+
462
468
When preparing a codebase for deployment,
463
469
it's often convenient to separate out the actual source code of our production app,
464
470
from the rest of the files that you need in the project.
465
471
A folder called _src_ is a common convention.
466
472
473
+
// DAVID: I'd expect src here and below to be in monospace.
474
+
467
475
Currently, all our code is source code really, so we move everything into _src_
468
-
(we'll be seeing some new files appearing outside _src_ shortly.footnote:[
476
+
(we'll be seeing some new files appearing outside _src_ shortly).footnote:[
469
477
A common thing to find outside of the _src_ folder is a folder called _tests_.
470
478
We won't be doing that while we're relying on the standard Django test framework,
471
479
but it's a good thing to do if you're using pytest, for example.]
472
-
)
473
480
474
481
475
482
@@ -516,6 +523,13 @@ Cool! We'll find out more about all of these steps as the chapter progresses.
516
523
Impartiality commands me to also recommend https://podman.io/[Podman],
517
524
which is a like-for-like replacement for Docker.
518
525
526
+
// DAVID: It might be worth mentioning Colima, which I have running on my machine
527
+
// instead of Docker because of licensing restrictions. I was able to run the
528
+
// same command because I have Colima installed. The good thing about Colima
529
+
// is you just use the same `docker` command, don't need to change it.
530
+
// Also - possibly worth moving the alternatives a couple of paras further
531
+
// up, so that they know their options before running the Docker install?
532
+
519
533
It's pretty much exactly the same as Docker,
520
534
arguably with a few advantages even, but I won't go into detail here.
521
535
@@ -527,7 +541,7 @@ Docker is open source too,
527
541
so I decided to stick with it. But you could definitely check it out!
528
542
529
543
You can follow along all the instructions in the book
530
-
by just substituing the `docker` binary for `podman` in all the CLI instructions,
544
+
by just substituting the `docker` binary for `podman` in all the CLI instructions,
531
545
e.g.
532
546
533
547
[role="skipme"]
@@ -550,6 +564,9 @@ including the operating system, dependencies, and any code you want to run.
550
564
551
565
Once you have an image, you can run one or many containers that use the same image.
552
566
567
+
// DAVID: Not sure whether this is going to be understandable in its current form.
568
+
// An analogy that I find helpful here is that images are like classes
569
+
// and containers are like instances.
553
570
554
571
==== A First Cut of a Dockerfile
555
572
@@ -566,6 +583,11 @@ What do we need to do? Something like this, right?
566
583
We create a new file called _Dockerfile_ in the base folder of our repo,
567
584
next to the `src/` directory we made earlier:
568
585
586
+
// DAVID: As discussed, I misread this and put the Dockerfile in src.
587
+
// That led to a difficult to understand error message when I tried to build.
588
+
// ERROR: failed to solve: failed to compute cache key: failed to calculate
589
+
// checksum of ref e126cbb4-3e0c-4e6e-867f-dbfbf5fb190f::k2oys44pcnbefrlpps3ooux7w: "/src": not found
590
+
569
591
// JAN: I'd suggest to use python3.11:slim or python3:12 slim. Keeping image tags too open leads to issues in a couple of months (not always, but waaay too often)
570
592
// JAN: I'd use Docker comments with # for <1>, <2>, ... Otherwise, you need to edit the code when you paste it
571
593
@@ -711,6 +733,9 @@ environment?
711
733
----
712
734
713
735
736
+
// DAVID: I got:
737
+
// python: can't open file '/src/manage.py': [Errno 2] No such file or directory
0 commit comments