Practice repository with basic commands to work with Django Framework
Tutorial followed from tangowithdjango
- install virtual environment and enable it
- install Django
- install other required libraries inside the venv
- start new django project
- add a new app to the project
- Create a view
- Create url mappings
- Add templates to views
- Add static files to HTML
- Setup media dir
- Creating Models
- Creating and migrating the databases
- Setup Database and Create Superuser
- Creating / Updating Models / Tables
- Run population script for the databases created
- Import models in views and create views for data to be returned to tempate
- Display data in template from context object in view
- 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.