Python Getting Started w/ Django Framework

Getting Started

Let's begin the tutorial by installing Python if you haven't have it yet. You can download Python IDLE(Integrated Development And Learning Environment) using this link: Download Python After installing Python, let us now install Django. You can do so by opening command prompt(press search then type cmd) and type pip install django pythondjango

Creating our Directory

Create a directory folder where you will put your app or website. In this tutorial, I've created django project folder in my desktop. Open cmd on the directory you created. In windows, you can do so by right clicking the folder and click Open command window here or navigate to the folder and then simply type CMD in the address bar and hit Enter to open the command prompt window there. foldercmd

Creating our Site

On the directory folder that we created, type django-admin startproject samplesite. samplesite Here, we have created our site named samplesite

Running the Server

Go to the site that we have created by typing in cd samplesite. Then, type the python that you want the site to use(this is the python that you have installed). If you have several python versions installed on your computer, you can do this by typing the full directory of the python the you want to use. In my case, I only have python3, so, I'm going to just type python manage.py runserver. runserver

Test the Site

We now check if our website is running by typing 127.0.0.1:8000 in your browser which is the localhost of Django. Your site should look like this. If it doesn't, something went wrong or you missed a step. thesite That ends this tutorial. Happy Coding :)

Add new comment