Starting with Django:
- Create a virtual environment
- Install Django inside that folder [!pip3 install django] then you will have django-admin.
- django-admin allows us to do all sorts of task in django like creating a project [!django-admin startproject projectName . ] then you will see like [manage.py and projectName].
- To run server you will use [!python manage.py runserver], it will show some error but ignore that for now and It will give you web address like: https://127.0.0.1:8000/ go to that link (hey, Congratulation you have django working) and You are ready to go now !!!
- There is setting.py file that is main Component of the whole project.
Built-In Components:
- Apps [Build-In and third party].
1.1. [Build-In] apps are like admin panel[https://127.0.0.1:8000/admin] and The first question would be: How to create a login for the admin panel?
Ans: Actually it's simple.[!python manage.py migrate and !python manage.py createsuperuser] and signUp for username and password for admin panel.
1.2.[third-party] apps are products, carts, blogs etc.
To create custom/third-party apps (Don’t confuse with the mobile apps in your device it’s not like that It's just the small component of the whole django project like products, carts, etc for e-commerce django-project) [!python manage.py startapp custom_app_name] (NOTE!!!: It should be on the root folder, the root folder is where manage.py is)
1.2.1.[third-party(Product or Chart)/model.py]
(I wanna store Product Info how do i do that, well code that in model.py)
(NOTE!!!: After you create third-party app like this you have to add it in ‘projectName/setting.py’ , Inside there you will see the list datatype of installed_app that where you will add custom_app_name as a list and don’t confuse with a custom app and third-party app both are same.)
[!python manage.py makemigrations and python manage.py migrate](These two command should be used each time you make a change in model.py)
- 2.2.[third-party(Product or Chart)/admin.py]
You got the model now you want to see that model in the admin.py