by Tom Victor Posted on June 23, 2017, 8:50 a.m.
As you all know python is one of the powerful modern programming languages, you can extend your Python skill to the server side backend development, REST API processing, Web App Development, Mobile App Backend using the Django Web framework. Django powers a lot of modern Apps we use every day some of them are
Navigate to your Desktop on terminal and create a new folder called Django
Navigate the new folder(using cd command), Now we will create a new virtual environment for our project, virtual environment helps us to isolate this project and its dependencies from the other apps on our computer.
Here I am using python version 3 (You can also try Python 2.7). Type the following command for new virtual "myenv"
virtualenv myenv -p python3
Now a new folder called "myenv" will be created in the current directory. for activating the new virtual environment type the following command
Now you can view the current python interpreter typing the following command
Install Django using the following command
pip install django
Now type freeze command to check whether the installation is successful
Now start a new Django by typing the startproject command, here I am starting a project called "Django bin", you also give a different name
django-admin startproject djangobin
Open the project in your favorite IDE, Here is the Sublime Text 3
Now we have to create database tables for the Django default settings, for that, we will type the migration command. This command will create a new SQLite database file in the root directory. The default database table will contain the user model, session and CSRF tokens and more, no need to care about those at this point.
Unlike other traditional stacks, the Django came with an inbuilt server for the easy development. So we don't need to configure a local Apache server and MySQL instance. You just need to type a simple command for runserver. ie
python manage.py runserver
The above command will run a development server on your local comouter. the default port is 8000, you can also chane this to any port by providing it as arguments. Now open your favorite web browser of choice and go to 127.0.0.1:8000 . You will be able to see the django welome page.