From 03eeec936e5724a81d22d9e3524e2bc9f3ae3dd3 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 18 May 2017 18:39:26 +0530 Subject: Updated as per feedback --- tutorial_2_django_proj/slides.md | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'tutorial_2_django_proj') diff --git a/tutorial_2_django_proj/slides.md b/tutorial_2_django_proj/slides.md index 4c55e59..69a5642 100644 --- a/tutorial_2_django_proj/slides.md +++ b/tutorial_2_django_proj/slides.md @@ -3,7 +3,7 @@ Tutorial: Creating Your First Django Project Slide 1 [00:08 | 00:08] ------------- -** Creating Your First Django Project ** +Title Slide: ** Creating a Django Project ** Slide 2 [00:13 | 00:21] -------------- @@ -11,8 +11,8 @@ Slide 2 [00:13 | 00:21] **Learning Objectives** In this tutorial, we will learn to; - - create django project - - initialize django app + - Create a django project + - Initialize a django app Slide 3 [00:13 | 00:34] --------------- @@ -28,12 +28,13 @@ Slide 4 [00:15 | 00:49] **Pre-requisites** In order to follow this tutorial, you need to know; - - django installation and virtual environment + - how to use a virtual environment + - how to install django - If not, see the relevant django tutorial on http://spoken-tutorial.org Demonstration: [01:15 | 2:04] ------------ -- Revist the virtual environment created in previous tutorial. +- Revisit the virtual environment created in previous tutorial. - Activate the virtual environment - Create a new directory - mkdir myproject @@ -41,9 +42,9 @@ Demonstration: [01:15 | 2:04] - cd myproject - Run the command - *django-admin startproject mysite* - This will create a django project 'mysite' + - This will create a django project 'mysite' -Demonstrations: [01:00 | 3:04] +Demonstration: [01:00 | 3:04] ------------- - So django project is - collection of settings for an instance of Django @@ -68,16 +69,21 @@ Slide 5: [00:10 | 3:14] Demonstration [01:00 | 4:14] --------------- - - Check if you have setup Django project correctly; + - Now let us run the django server and check; - *python manage.py runserver* - You will see that the server is running at the address shown. - Go to the address via web browser - We see the django's index page- "It works" + - You will see that the server is running at the address shown. + - Go to the address via web browser + - We see the django's index page- "It works" + +Slide +----------- +**Initializing a Django App** + - A Django project typically contains one or more apps + - A Django app performs a particular task + - Let us create a blogging app called 'blog' Demonstration [01:30 | 5:44] -------------- -**Initializing a Django App** - - Create a blogging app called blog - Run the command; - *python manage.py startapp blog* This creates an app 'blog' @@ -85,6 +91,7 @@ Demonstration [01:30 | 5:44] - Execute *cd blog/* - You will see the file structure(This can be in slide or terminal) + blog/ |-> __init__.py |-> admin.py @@ -94,12 +101,14 @@ Demonstration [01:30 | 5:44] |-> models.py |-> tests.py `-> views.py + - Return to the parent directory - *cd ..* -Demonstration [00:] +Demonstration [01:00 | 6:44] ------------ ** Adding the app to the settings file** + - For the project to detect an app, we need to add the app name to settings.py - Open the *settings.py* file - Go to *INSTALLED_APPS* and add *'blog.apps.BlogConfig',* to the list so it should now look like this; @@ -113,7 +122,7 @@ Demonstration [00:] 'django.contrib.staticfiles', ] -Slide 13 [00:15 | 05:55] +Slide 13 [00:25 | 07:15] --------------- ** Assignment ** - Create a new project and app -- cgit