All Blogs Go to Heaven
What I'm Using - Part I
Published: July 1, 2019, 11:35 a.m.
Edited: July 9, 2019, 4:34 p.m.
This site relies on a lot of tools even though it is very simple. All of the tools are very simple to use (at least the basics are simple), but even that small stuff adds up if you are new. When I first started programming I didn't realize how many different parts worked together to make a project work and was a bit overwhelming when I learned about a completely new requirement at every turn.
I do not use close to the full power of any of these tools, but here is a comprehensive list of everything I dealt with for this site:
- Python (not much other than Django)
- Django (web framework written in python
- HTML (just the basics; the fun is in css, js, and django)
- CSS (formatting, fonts, etc)
- JavaScript (interactive actions on a single page)
- Bootstrap (okay... honestly most of the css and js is Bootstrap, I just picked from what they offer)
- Gunicorn (I'll be honest, I don't fully understand, but it's an interface that runs python code optimized for webservers)
- Nginx (The actual webserver that manages requests and serves up the response)
- DigitalOcean (company that hosts this site... awesome so far)
- PyCharm (IDE: not necessary, but man, it makes things easier)
- Debian/BASH (OS the site runs on and associated command line shell)
I'm going to start with the OS since setting up a good development environment is important and often ignored. I run Debian 9 on my home computer so it was easy to choose that for the server. I easily could have chosen a fully loaded Ubuntu server, but for fun I decided to start with a pretty bare Debian install and then install packages as needed. That process can be time consuming and annoying, but since I've installed Debian a few times in the past I opted to take the slower route and pay more attention. I'm hosting on Digital Ocean which has a preconfigured Ubuntu Nginx/Gunicorn/Django option that might be easier for future projects.
The first step is installing python 3.7 since 3.5 is the current system install on Debian. Hopefully python has been developed in such a way that there are no breaking changes Debian could run with 3.7 instead, but the better option is to perform an "altinstall" so that the python executable is in a different place and nothing clashes in the system. I'm going to be using a virtual environment anyway, so it will all appear the same once the install is done. Before installing python, a few important libraries and programs need to be installed.
- gcc/g++
- make
- libssl-dev
- libffi
For all of these check your system with apt list [name_of_package]
(always run sudo apt update
first). If you don't know the exact package name use an asterisk wildcard. To see any of the SSL library packages run apt list libssl*
. Finally, install with sudo apt install [name_of_package]
.
gcc and g++ plus are the standard GNU compilers. I'm not writing any C/C++ here, but python is written in C and needs these to install. If you're interested in the differences this stackoverflow question explains it. The install also needs make. I think most Linux installs will have gcc and make preinstalled since they are necessary for so many things, but since I opted for a stripped down version there are a few more steps.
libssl-dev is required for pip (and probably a lot more). This is the dev package for SSL/TLS and python packages won't be able to install without it. I hope to get to it later, but there are actually some minor issues with the libssl family since Node.js on Ubuntu/Debian requires the older library. It's easy to deal with, but if you're installing Node.js make sure not to install using apt (at least at the time I am writing this... I'm sure it will be updated soon).
And now for everyone's favorite libffi! This is the last of the required libraries for a python install and it is used by ctypes module. There are a few other libraries that can also be installed to get some glorious C speed in python, but I didn't install all of them for this project.
After all of that... now we can actually install python. At this point it's simple. Download the source and unzip it and then run:./configure --enable-optimizations
make -j4
sudo make altinstall
It is important to run altinstall and not install
There are a ton of resources, but this one is very nice.
Coming up next... A bit of python/Django and I profess my love for PyCharm.