diff options
author | ankitjavalkar | 2017-05-18 18:39:26 +0530 |
---|---|---|
committer | GitHub | 2017-05-18 18:39:26 +0530 |
commit | 03eeec936e5724a81d22d9e3524e2bc9f3ae3dd3 (patch) | |
tree | e1bdec3b1976a4f0916ede999ffe1599d6913c47 /tutorial_2_django_proj | |
parent | 7b4dce1b0db92f0301c34516ce3a93c89087676a (diff) | |
download | learn_django-03eeec936e5724a81d22d9e3524e2bc9f3ae3dd3.tar.gz learn_django-03eeec936e5724a81d22d9e3524e2bc9f3ae3dd3.tar.bz2 learn_django-03eeec936e5724a81d22d9e3524e2bc9f3ae3dd3.zip |
Updated as per feedback
Diffstat (limited to 'tutorial_2_django_proj')
-rw-r--r-- | tutorial_2_django_proj/slides.md | 39 |
1 files changed, 24 insertions, 15 deletions
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 |