This is a beginner’s guide to Django Framework for backend Development with MySQL, DjangoRestFramework that can be integrated with any frontend. We are creating a simple system that exposes database data an API that we create using DRF.

Image for post
Image for post
Illustration of the concept

Django Installation and Python Virtual Environment

You want to create a development environment which you can control. Virtual Environments help you install all packages that you need for a specific development task without necessarily affecting your base system. It also helps you manage dependencies when deploying the application.

--Virtual Environment
$sudo apt install python3-venv python3-pip
$python3 -m venv “/path to your location…


Installing MySQL-server on Debian 9 installs MariaDB by default. MariaDB works fine in replacing MySQL and allows you to run MySQL syntax and commands as you would with MySQL. Full comparison here. However, if you want to install MySQL (community server), this guide is for you.

Cleaning the system

$sudo service mysql stop$sudo apt-get --purge remove "mysql*"$sudo apt-get clean$sudo apt-get autoremove$sudo apt-get autoclean$sudo apt-get update

Download the latest apt-config for MySQL from https://repo.mysql.com/ and install it. Update the repository and install some dependencies.

$sudo dpkg -i mysql-apt-config_*.deb
$sudo apt-get update && sudo apt-get install libmysqlclient-dev

Ubuntu Note:: If you are using Ubuntu install two extra dependencies that i found to cause errors on a new system. …

About

Chrysostom M

Python Developer, SQL, React, Data science and ML

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store