Prerequisite : Django – Creating project
Django is a great framework which provides you a lot of pre-defined services and workflow so that one can work flawlessly. Django apps are designed to make your code clean and reusable. Django works on the concept of DRY which means Don’t Repeat Yourself.
After creating project , your directory should look like this:
Doesn’t it look a little confusing? Two folders with the same name? So, here is good news. You can change the name of the outer folder because it is just a folder containing your project but please don’t change the name of the inner folder. Let’s rename the outer folder as geeksforgeeks.
Now, it should look like:
After completing Set 2, you have got Django server worked –
but did you notice the warning in red color?
You have 15 unapplied migrations…
We will discuss about such warnings later. For the sake of simplicity, let’s remove the warnings for now. Stop your server using CTRL+C. Run the following command in your terminal:
python manage.py migrate
Now on your command prompt, you will see something like this:
Now run command
python manage.py runserver
Congratulations, you have silenced all warnings
Moving towards Django apps –
We can get rid of
views.py because Django apps are supposed to handle with views. Also, remove these two lines from related files.
from geeks_site.views import hello_geeks path('geek/', hello_geek),
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course