Django
Just think. There are hundreds of different versions of Linux. There are many different databases available, many web servers and many front end development frameworks you can choose from. You can mix and match them in any combination you want to.
A big part of my objective with this section of Holistic Home Office is to help you find your way through all the options. To show you some questions you can ask and a trail you can follow. Other people can teach you a lot more about the details of computer programming and website development than I can.
I’m working on learning and putting together a high performance, home office based, full stack, local development environment for building and maintaining websites and other applications in your holistic home office.
I’ve looked at the PHP and Drupal workflow and have decided to develop a Python and Django system. Flask is a simpler python framework. Flask is a good system for you, if you want to learn all the details about how to assemble a python based development environment.
Django does a lot of tasks automatically that you have to do manually in Flask. Each one has its advantages and disadvantages. You have more design freedom with Flask. Django was originally designed as a news magazine framework. Well, I intend this website to be a news magazine website about the holistic home office niche of our universaal commonwealth.
Plus, while I am trying to learn everything I can about every piece of this puzzle, I would just as soon have Django do things automatically, as have to do everything manually.
Computer Science
I’ve been doing a lot of research about various peaces of the puzzle. Linux is the foundation. Your Universal Extensible Firmware Interface (UEFI) uses code stored in Non-Volatile Random Access Memory (NVRAM), which remembers what is stored in it when you turn your computer off, to start your Linux Kernel.
Your Linux kernel then starts systemd. systemd starts your desktop and all of your applications. Linux manages the processes running on your computer using unit files. Ubuntu, the Linux Distribution I use, has recently started using Snap packages to manage your applications.
I’ve noticed that PostgreSQL and Nginx are systemd unit files. Most of the Kubuntu packages I have installed have a config file in the .config directory in my home directory.
Snap packages are essentially containerized packages. Putting your packages into containers protects your operating system and other snap packages from each other. So, if one package breaks down, it doesn’t damage your entire system.
You may want to use LXC and LXD to containerize the pieces of your web development stack. You’ll create a directory for each website and cd into that directory. Then create a new LXC container. If you use Docker, you can pull in a Django-Nginx container and a PostgreSQL container.
Nginx is the fastest, most advanced web server in the world and PostgreSQL claims to be the most advanced database in the world, so naturally, those are the ones I want to use. And the ones I am recommending.
Get familiar with PostgreSQL. Learn how to get it installed in the right place and configure it to work with both Apache2 and Nginx and LXC and Django.
I’m just getting started, so this story is more like an evolving strategic plan, rather than a lesson. I’ll keep updating it as I learn more and make progress getting my own system set up.
And then, once you get your instance of Django installed and configured, you can add Zurb-Foundation and Vue for your front end development. Zurb-Foundation is an HTML and CSS framework and Vue is a Javascript framework. They automate much of the front end development process for you.
So, PostgreSQL, Nginx and Django are the back end tools and Zurb-Foundation and Vue are front end tools you will be using to build your web applications. There are others. See if you can use the KDE database technology, Kexi, in your system. That way, it will be more compatible and integrated with your KDE Plasma desktop and your local development environment.
Once you get a very high performance system set up, you can make a template out of it, possibly an LXC image, and be able to spin up a new website very easily, whenever you decide to write about another subject.
Read a lot. Watch a lot of videos. Keep learning. And writing. Be a prolific writer. Learn how to use Krita, Gimp and Raw Therapee to make beautiful art. Be an artist and salesperson, a scientist and business man or woman.
Create something valuable and trade it on our one world wide web of entertaining education. Add value to our global cloud of artificial intelligence.
Django Setup
cd into your Sites directory. mkdir a website directory (projects in this example). cd into it. Use the command
python3 -m venv my_py3_venv
to create a virtual environment for your website. venv is the container Python uses for local development. ls to see your project in your project directory. Use the command
source my_py3_venv/bin/activate
to activate your virtual environment. Use
django-admin startproject test1
to start your project. Then, cd into your test1 project directory. Use
python manage.py runserver
to start your website. This is some of the output I got in this test1 project
Watching for file changes with StatReloader Performing system checks… System check identified no issues (0 silenced). You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. September 17, 2019 - 03:23:56 Django version 2.2.3, using settings 'test1.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. ...
Copy the http;//127.0.0.1:8000/ and paste it into your browser’s address bar and enter to start your Django website.
Back in your terminal, use control-c to get out of the server and run
python manage.py migrate
Use
python manage.py runserver
to restart your server and then re-enter http;//127.0.0.1:8000/ into your browser address bar and walah, you have a Django website set up on your computer. Start experimenting with it.
Remember to control-c to close your server when you are not using it, so it is not running in the background using up your computer’s resources.
Returning to Work
To restart your website after you’ve been gone for a while, cd into your Sites/project directory (my test site is at ~/Sites/project/test1) and use the command
source my_py3_venv/bin/activate
to restart your server and then cd into your test1 directory and run
python manage.py runserver
Type localhost:8000 into your browser address bar and you’re in, ready to work on your website.
And thanks to Seattle OpenSource Linux Meetup group and the official Django Documentation for helping me finally figure this out.
Update
Since I wrote this article, I’ve switched to using WordPress, with Kadence Pro theme. I’m using the Gutenberg editor and have not been working in my own local development environment. I can create all my content and a very nice looking website using Gutenberg and Kadence without touching the command line.
I also ruined my KDE Neon laptop and do not really want to get rid of the Windows on this desktop, so I’ve been working with Windows for the last several months. My plan is to get a Microsoft Surface Pro laptop, in order to have access to the Microsoft cloud and a KDE Neon Slimbook laptop. I may switch to System76 and Pop!_OS, just because System76 is an American company that makes hardware and software in the USA. Then, I’ll install Linux on this desktop and get back to work on developing my local development environment.