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,
@@ -463,17 +466,21 @@ TIP: Don't use `export` to set the 'TEST_SERVER' environment variable;
463
466
464
467
==== Making an src Folder
465
468
469
+
// DAVID: FWIW it reads weirdly to me to have 'an src' rather than 'a src'.
470
+
// It's probably because I pronounce it as 'source' rather than 'S.R.C.'
471
+
466
472
When preparing a codebase for deployment,
467
473
it's often convenient to separate out the actual source code of our production app,
468
474
from the rest of the files that you need in the project.
469
475
A folder called _src_ is a common convention.
470
476
477
+
// DAVID: I'd expect src here and below to be in monospace.
478
+
471
479
Currently, all our code is source code really, so we move everything into _src_
472
-
(we'll be seeing some new files appearing outside _src_ shortly.footnote:[
480
+
(we'll be seeing some new files appearing outside _src_ shortly).footnote:[
473
481
A common thing to find outside of the _src_ folder is a folder called _tests_.
474
482
We won't be doing that while we're relying on the standard Django test framework,
475
483
but it's a good thing to do if you're using pytest, for example.]
476
-
)
477
484
478
485
479
486
@@ -520,6 +527,13 @@ Cool! We'll find out more about all of these steps as the chapter progresses.
520
527
Impartiality commands me to also recommend https://podman.io/[Podman],
521
528
which is a like-for-like replacement for Docker.
522
529
530
+
// DAVID: It might be worth mentioning Colima, which I have running on my machine
531
+
// instead of Docker because of licensing restrictions. I was able to run the
532
+
// same command because I have Colima installed. The good thing about Colima
533
+
// is you just use the same `docker` command, don't need to change it.
534
+
// Also - possibly worth moving the alternatives a couple of paras further
535
+
// up, so that they know their options before running the Docker install?
536
+
523
537
It's pretty much exactly the same as Docker,
524
538
arguably with a few advantages even, but I won't go into detail here.
525
539
@@ -531,7 +545,7 @@ Docker is open source too,
531
545
so I decided to stick with it. But you could definitely check it out!
532
546
533
547
You can follow along all the instructions in the book
534
-
by just substituing the `docker` binary for `podman` in all the CLI instructions,
548
+
by just substituting the `docker` binary for `podman` in all the CLI instructions,
535
549
e.g.
536
550
537
551
[role="skipme"]
@@ -554,6 +568,9 @@ including the operating system, dependencies, and any code you want to run.
554
568
555
569
Once you have an image, you can run one or many containers that use the same image.
556
570
571
+
// DAVID: Not sure whether this is going to be understandable in its current form.
572
+
// An analogy that I find helpful here is that images are like classes
573
+
// and containers are like instances.
557
574
558
575
==== A First Cut of a Dockerfile
559
576
@@ -570,6 +587,11 @@ What do we need to do? Something like this, right?
570
587
We create a new file called _Dockerfile_ in the base folder of our repo,
571
588
next to the `src/` directory we made earlier:
572
589
590
+
// DAVID: As discussed, I misread this and put the Dockerfile in src.
591
+
// That led to a difficult to understand error message when I tried to build.
592
+
// ERROR: failed to solve: failed to compute cache key: failed to calculate
593
+
// checksum of ref e126cbb4-3e0c-4e6e-867f-dbfbf5fb190f::k2oys44pcnbefrlpps3ooux7w: "/src": not found
594
+
573
595
// 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)
574
596
// JAN: I'd use Docker comments with # for <1>, <2>, ... Otherwise, you need to edit the code when you paste it
575
597
@@ -715,6 +737,9 @@ environment?
715
737
----
716
738
717
739
740
+
// DAVID: I got:
741
+
// python: can't open file '/src/manage.py': [Errno 2] No such file or directory
0 commit comments