FIRST DJANGO SERVER RUN

Ashish Sharma
4 min readMar 19, 2018

So finally, I am back to my residence after spending some time in my hometown. It was a really tough time for my family and me but still I tried to write and share stuff as much as possible. But one good thing indeed happened. I used to get around 30–40 views on my Facebook videos on my page(https://www.facebook.com/ashishsharma260696/). One day, I shared one of my video in a group on Facebook (of which I am a member) and the response was amazing. Since then, everyday I wake up and share one of my works which I have done in the past in different groups and pages. Till now, I have shared 10 of my videos, out of which three has 1k+ views and the rest all has almost 500+ views. So I am pretty happy with my work. Sorry for diversion, I just wanted to share this little achievement of mine with my readers. So let’s jump into Django again!!!

Thanks to everyone for liking my page and watching my videos.

So today we will be making our first Django Project. You must be wondering that we just started last week, how can we make a project now? Django Project is a collection of Django applications and configurations which work together to form a webpage. So we will be just creating a project and then running the server. If we run the server without even making any Django application, by default it will show you some content. So after activating our venv (virtual environment) which we created earlier, we have to use the following command:

django-admin startproject project_name

django-admin command comes with Django. We can create a separate folder for our Django by using md which stands for make directory and then change our directory by using cd as shown:

MyDjang is the name of my venv.

As soon as we create our project, inside the folder DjangoBasic, we can find a folder named FirstRun along with a file manage.py. Inside our FirstRun folder, we can find following files:

__init__.py is an empty file which can be used as a package, if we want to. settings.py as the name suggests stores all our settings for the web page. urls.py will contain all the url patterns for different web applications. wsgi.py is web server gateway interface which will be used in later process to deploy our web page. We will be using manage.py file to run our server. To use the manage.py, we have to first change our directory and then give the following command:

python manage.py runserver

So in the above command, we are telling our python to execute the manage.py and run the server. Then the system check will look for any issues and show them. It will then report the migrations for your project, we will discuss later about migrations. If everything goes smoothly upto this point, then we can see our server starting as shown:

If we copy the address and paste it in our browser, it results in:

As shown, since we have not created any URLs, this page is shown to us. The figure will be an animation of a rocket ready to run. We can stop our server with ctrl+c and we can exit the anaconda with exit command. So that’s all for today, I know I am going very slow but I don’t want to rush into anything. We will be creating our most favorite “HELLO WORLD” webpage in the next blog, till then keep coding…

Thank you for reading, if you liked the article please click on the clap button and show your support. You can clap more than once, just keep pressing the icon!!!

--

--