How to create REST APIs using Django: Talk delivered at Slack Community Jaipur
sudo apt-get install python3-pip mysql-server
pip3 install virtualenv pymysql
virtualenv -p python3 -v env
. env/bin/activate
django-admin startproject slackrestapis
mysql -u root -p
create database slackjaipur;
ALTER DATABASE slackjaipur CHARACTER SET 'utf8';
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON slackjaipur.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
exit
ENGINE: django.db.backends.mysql NAME: 'slackjaipur' USER: 'user' PASSWORD: 'password' HOST: '127.0.0.1' PORT: '3306'
python manage.py makemigrations
python manage.py migrate
pip install djangorestframework
python manage.py startapp restapis
And add 'rest_framework' to your INSTALLED_APPS setting
python manage.py runserver
Follow this short offical django tutotrial on how to install Django on windows
Now to setup a Django project follow this tutorial
Follow Step-2 of this tutorial to install and connect MySQL to Django on Windows
Then follow step-7 to step-11 in previous part
Alternate: Setting up Django with MySQL can be a little bit tricky on windows if you are new. You can use this method instead :-
Install virtualbox on windows
Install Ubuntu 20.04.2.0 LTS on it using this iso image
Follow this tutorial on how to install Ubuntu on virtalbox
sudo apt-get install update
sudo apt-get install upgrade