MacOS comes with PHP 7, Apache2 http server, and SQLite built-in which is everything you need to run a Drupal site. If you want to use MySQL, that is an additional install. In this guide, we will look at how to setup Drupal on your Mac.
Composer is a command-line tool for managing dependencies in PHP projects. In this guide we will look at how to install Composer and use it to add and install some project dependencies as well as how to create your own local package and use it within an application.
The GitPython project allows you to work in Python with Git repositories. In this guide we'll look at some basic operations like:
- Initializing a repo
- Cloning a repo
- Adding and committing
- Pushing and pulling with remotes
- Checking for changes
- Getting a diff
- Listing and switching branches
SSH (secure shell) is good for remotely managing machines using a secure connection.
Typically you will log in to a server using the command-line
ssh tool, or something like
PuTTy or MobaXTerm. This guide will show you how to use Python to connect and run commands
over SSH using the Paramiko package.
FTP or File Transfer Protocol is a common way to transfer files. For FTP, Python has a built in package called ftplib.
There is also a Secure File Transfer Protocol (SFTP) that uses SSH to encrypt the communication. We will focus just on traditional FTP in this guide. For SFTP you can check out the Paramiko package.
In this guide, we will look at some basic operations like:
- Connect and login to an FTP server
- List directories and files
- Upload and download files
Note these examples are all using Python 3.
Python 3 has built-in libraries for IMAP, POP3, and SMTP. We will focus on learning how to send mail with SMTP and read/manage email with IMAP. We will also look at how to send an SMS text message using email.
If you need your own email hosting, check out Interserver.net hosting where you can host unlimited emails for unlimited domains as cheap as $4/month. You could also set up your own SMTP server on a VPS, but that is a hassle.
MySQL is an ubiquitous database server. Many hosts, like Interserver.net offer unlimited MySQL databases with a $4/month plan. With their hosting, you can also setup as many PHP, Python, Ruby, or Node.js apps.
There are a few libraries available, but the one I'm focusing on is PyMySQL, a pure Python implementation. This version is the easiest to install with the least amount of dependencies and most portable.
You could use an ORM like SQLAlchemy or Django. Those options are good if you need to easily switch between MySQL and another database like SQLite. Here, we will focus only on MySQL and assume this is the only database being used.
If you're interested in learning how to setup a Python web app on Interserver, it is really easy using cPanel. Check out my tutorial Setup Python WSGI apps on cPanel (Flask/Django).
If you want to create a bootable SD card or USB flash drive using a disk image like a
.img you have a few options.
- Use the
- Use a GUI tool like BalenaEtcher
This is a common task when setting up an SD card for a Raspberry Pi or creating a USB flash drive with a Linux LiveCD distro. In this example we will review both the Etcher option and
For a long time only PHP applications were well supported in cPanel, but now Python, Ruby, and Node.js apps can be deployed easily. In this guide, I will walk through the steps and configuration needed to run a plain WSGI app, a Flask app, and a Django app. In my cPanel version, it says cPanel 11 (86.0.13).