Deploying django applications

Hi!

First of all, there is a bit of difference between plain LXC and LXD (LXD/LXC). As a new user, it is suggested to look for LXD, which simplifies greatly how containers (machine containers) work. The term machine container means the container feels just like a full Linux machine, and you deal with it just like you would deal with a new server. And you can have many of those inside your computer. See more at Comparing LXD vs. LXC

If I were to install a django application, I would

  1. Set up LXD according to https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ (or https://blog.simos.info/trying-out-lxd-containers-on-our-ubuntu/ )
  2. Create a machine container for django, lxc launch ubuntu:16.04 mydjango
  3. Run lxc list to see the private IP address of the machine container.
  4. Connect to the machine container mydjango, lxc exec mydjango -- sudo --login --user ubuntu and you get a shell as user ubuntu (that can sudo to root without password).
  5. Install django and your app as you would normally do. Then, on Firefox, connect to the IP address of the machine container (the private IP address that you get when you run lxc list).
1 Like