You must follow first- Django: A Beginners Guide to Learn Part-1
Setting up an App by Django a beginners guide
All right the next step is to now create or project you\’re probably wondering what was this directory for.
Why I thought we\’ve created the project.
Well no you have a directory first project right inside of that.
You\’re going to have a main web site you can call it my site.
You can go and test project anything you want.
And then after this Web site you can create the pools application.
I know it\’s a bit confusing but bear with me.
What do you want to do.
Is your terminal right now.
Go ahead and type this command.
I want you to type ‘Django-admin start project my site’.
And all this does is it creates a new directory known as my site and then also create some auto generated Django code that we have to have so quickly go over what each of these .py files are probably the most important one right now is going to be manage .py files and all managed up .py files allows us to talk to Django through the terminal.
So if you have to run an application if you have to access the Django shell if you have to make or migrations all of that we would do through the terminal by managed up .py, you want done double score in it up .py.
That basically is an empty file that tells Python that the folders the package settings up .py pulls the settings for our website.
So any apps that we have to add anything like that that will be in the settings PY file you aroused PY is pretty key any way around.
In our Web site will go through here through these url patterns will access those url and Websites.
So this is our major Website.
Inside the website
Now inside of this Web site.
We can have apps any amount of apps.
Suppose I was creating a shopping site in that shopping site.
I also add a blog where I posted articles on my latest things that add to my shopping site.
I also have maybe a Polls up to see if people are liking this product or that product.
Every site can have as many apps as you want to better understand this take a look at your main website and then you can have any amount of apps that you can add onto your Web site.
And the best part you can add apps or take them away and nothing will change.
So this polls out I could literally copy and paste onto a different web site and it would still work.
So that\’s pretty cool
Creating polls up by Django – A beginners guide
The next thing I have to do is create this polls up.
So right now we\’ve created this fantastic.
The next step is to create this polls up right here so that once you type is using the managed up py file when and type the following command.
Python manage.py startup polls and it says Can\’t open file manage.py.
The reason being we\’re in the first project directory and we have to go to the my site directory.
So go ahead and say CD my site and now run the following command.
Python manage.py startup polls also so now if we close your my site and open or my site we have our Polls directory.
All again go over what the new files are and init.py.
Admin.py allows us to add stuff to the admin page than apps.py is use to configure app and models.py this is like the database layout.
You create classes you create objects here and then you populate them.
Tests.py you guys use for testing purposes and views.py is used to display content any content from a database to a web page through views.py.
So one last thing before you go for models of py is creating a database and that is let\’s go ahead and run our Django at least whenever we have so far.
So go ahead and type Python manage.py.
All right so it says you have unemployed migrations.
So what he wants us to do is he wants us to apply migrations.
Basically Django version control but only for models of py.
Go ahead and open up a new tab.
And if you go to 127.0.0:8000
What do we get.
Also it worked.
Congratulations on your first Django powered page by beginners guide.
We\’re getting their guys.
So this is your first Django powered page.
Again it doesn\’t really have anything.
It\’s pretty pointless but you can go ahead and add models and can then add values to a database.