Skip to content

PrataapMS/django_tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Tutorial to Learn

Tutorial followed from Django documentation and Tango with Django Book.

Practice repository with basic commands to work with Django Framework

Tutorial followed from tangowithdjango

Steps followed while working with this project:

  1. install virtual environment and enable it
  2. install Django
  3. install other required libraries inside the venv
  4. start new django project
  5. add a new app to the project
  6. Create a view
  7. Create url mappings
  8. Add templates to views
  9. Add static files to HTML
  10. Setup media dir
  11. Creating Models
  12. Creating and migrating the databases
    • Setup Database and Create Superuser
    • Creating / Updating Models / Tables
  13. Run population script for the databases created
  14. Import models in views and create views for data to be returned to tempate
  15. Display data in template from context object in view
  16. Learnt about slugify to get clean urls.

There are five main steps that you must undertake to create a data driven webpage in Django:

  • First, import the models you wish to use into your application’s views.py file.
  • Within the view you wish to use, query the model to get the data you want to present.
  • Pass the results from your model into the template’s context.
  • Setup your template to present the data to the user in whatever way you wish.
  • If you have not done so already, map a URL to your view.