From 1f5fac0a0a819d2c647deae2a44a42b735bb951d Mon Sep 17 00:00:00 2001 From: pocha Date: Wed, 23 Jan 2013 23:54:59 +0530 Subject: [PATCH 01/11] added one line of highlighted comment --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c3e5646..020ef1e 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ A Django project is a collection of settings for an instance of Django, includin These files are: -- **The outer django_blog/** directory is just a container for your project. Its name doesn't matter to Django; you can rename it to anything you like. +- **The outer django_blog/** directory is just a container for your project. Its name doesn't matter to Django; you can rename it to anything you like. - **manage.py:** A command-line utility that lets you interact with this Django project in various ways. It is a thin wrapper around django-admin.py. So inside a Django project you can run manage.py instead of django-admin.py. - **The inner django_blog/** directory is the actual Python package for your project. Its name is the Python package name you'll need to use to import anything inside it (e.g. import mysite.settings). +

import word is kind of alient. It needs some explaination

- **django_blog/__init__.py:** An empty file that tells Python that this directory should be considered a Python package. - **django_blog/settings.py:** Settings/configuration for this Django project. Django settings will tell you all about how settings work. - **django_blog/urls.py:** It handles the URL declarations for the Django project. This will simply map URL patterns (simple regular expressions) to Python functions (your views). @@ -106,4 +107,4 @@ You can test the same by running development server again. That is it, preview your application and you shall see the **Hello World** message. -That's it for this module. We'll get into models and get started with blog views in the next module. \ No newline at end of file +That's it for this module. We'll get into models and get started with blog views in the next module. From b97f109c59ad84b197a11f6b0fde5bb2d679b4e7 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 15:36:24 +0530 Subject: [PATCH 02/11] updating README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 020ef1e..e463516 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ These files are: - **The outer django_blog/** directory is just a container for your project. Its name doesn't matter to Django; you can rename it to anything you like. - **manage.py:** A command-line utility that lets you interact with this Django project in various ways. It is a thin wrapper around django-admin.py. So inside a Django project you can run manage.py instead of django-admin.py. - **The inner django_blog/** directory is the actual Python package for your project. Its name is the Python package name you'll need to use to import anything inside it (e.g. import mysite.settings). -

import word is kind of alient. It needs some explaination

+> import word is kind of alien. What exactly import does - **django_blog/__init__.py:** An empty file that tells Python that this directory should be considered a Python package. - **django_blog/settings.py:** Settings/configuration for this Django project. Django settings will tell you all about how settings work. - **django_blog/urls.py:** It handles the URL declarations for the Django project. This will simply map URL patterns (simple regular expressions) to Python functions (your views). From 174374b2b8626fc6b848f5ba359ff25d3aded440 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 15:37:42 +0530 Subject: [PATCH 03/11] updating README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e463516..eda79ee 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ These files are: - **The outer django_blog/** directory is just a container for your project. Its name doesn't matter to Django; you can rename it to anything you like. - **manage.py:** A command-line utility that lets you interact with this Django project in various ways. It is a thin wrapper around django-admin.py. So inside a Django project you can run manage.py instead of django-admin.py. - **The inner django_blog/** directory is the actual Python package for your project. Its name is the Python package name you'll need to use to import anything inside it (e.g. import mysite.settings). -> import word is kind of alien. What exactly import does +_import word is kind of alien. What exactly import does_ - **django_blog/__init__.py:** An empty file that tells Python that this directory should be considered a Python package. - **django_blog/settings.py:** Settings/configuration for this Django project. Django settings will tell you all about how settings work. - **django_blog/urls.py:** It handles the URL declarations for the Django project. This will simply map URL patterns (simple regular expressions) to Python functions (your views). From a22a5c5aa8541776d78434aade7c4eda2a834383 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 15:40:01 +0530 Subject: [PATCH 04/11] updating README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eda79ee..52b4c91 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,13 @@ These files are: - **The outer django_blog/** directory is just a container for your project. Its name doesn't matter to Django; you can rename it to anything you like. - **manage.py:** A command-line utility that lets you interact with this Django project in various ways. It is a thin wrapper around django-admin.py. So inside a Django project you can run manage.py instead of django-admin.py. - **The inner django_blog/** directory is the actual Python package for your project. Its name is the Python package name you'll need to use to import anything inside it (e.g. import mysite.settings). -_import word is kind of alien. What exactly import does_ - **django_blog/__init__.py:** An empty file that tells Python that this directory should be considered a Python package. - **django_blog/settings.py:** Settings/configuration for this Django project. Django settings will tell you all about how settings work. - **django_blog/urls.py:** It handles the URL declarations for the Django project. This will simply map URL patterns (simple regular expressions) to Python functions (your views). - **django_blog/wsgi.py:** An entry-point for WSGI-compatible webservers to serve your project. This will be used, once we want to deploy our application for production. For now, we'll ignore it. +_Feb 7 - import word is kind of alien. What exactly import does needs explanation_ + Now, that our project is setup. We can test it by running a development server. The Django development server is a built-in, lightweight Web server you can use while developing your site. It’s included with Django so you can develop your site rapidly, without having to deal with configuring your production server (e.g., Apache) until you’re ready for production From 67497680425e28502cf98cdc862b879569d039df Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 15:43:14 +0530 Subject: [PATCH 05/11] changed comment to blockquote --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52b4c91..b03b54b 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ These files are: - **django_blog/urls.py:** It handles the URL declarations for the Django project. This will simply map URL patterns (simple regular expressions) to Python functions (your views). - **django_blog/wsgi.py:** An entry-point for WSGI-compatible webservers to serve your project. This will be used, once we want to deploy our application for production. For now, we'll ignore it. -_Feb 7 - import word is kind of alien. What exactly import does needs explanation_ +> Feb 7 - import word is kind of alien. What exactly import does needs explanation Now, that our project is setup. We can test it by running a development server. From ec5bbada45ccc6b3fbe392f0e1473eb12f1e6ef1 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 15:55:44 +0530 Subject: [PATCH 06/11] removed spurious line & testing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b03b54b..951476f 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ To create your first Django project, goto the console and run This will create a folder *django_blog* with the following structure. Here, *django_blog* is the name of our project. -A Django project is a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings. +A Django project is a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings. ├── django_blog │   ├── __init__.py From 14140f5fce17f6b8ef77fbfddbef317be9f6b2c6 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 16:00:11 +0530 Subject: [PATCH 07/11] removed spurious line & testing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 951476f..da48866 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ To create your first Django project, goto the console and run This will create a folder *django_blog* with the following structure. Here, *django_blog* is the name of our project. -A Django project is a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings. +A Django project is a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings. ├── django_blog │   ├── __init__.py From b45422e3a8baa589eb89eaaaca07103099622a14 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 16:05:03 +0530 Subject: [PATCH 08/11] top level django_blog created --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index da48866..dae817b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,9 @@ To create your first Django project, goto the console and run This will create a folder *django_blog* with the following structure. Here, *django_blog* is the name of our project. A Django project is a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings. - +> No useful information + + django_blog ├── django_blog │   ├── __init__.py │   ├── settings.py From 7afd816f355fc7aab105f9a698ddeacc48bd99c5 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 16:05:41 +0530 Subject: [PATCH 09/11] top level django_blog created --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dae817b..9ae3a0c 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This will create a folder *django_blog* with the following structure. Here, *dja A Django project is a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings. > No useful information - django_blog + django_blog ├── django_blog │   ├── __init__.py │   ├── settings.py From 162e3c5052df5e11d7037ea07bc52abc1f5c8709 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 17:57:03 +0530 Subject: [PATCH 10/11] pushing final changes --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9ae3a0c..3d20b68 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ These files are: - **django_blog/wsgi.py:** An entry-point for WSGI-compatible webservers to serve your project. This will be used, once we want to deploy our application for production. For now, we'll ignore it. > Feb 7 - import word is kind of alien. What exactly import does needs explanation +> What is WSGI ? Now, that our project is setup. We can test it by running a development server. @@ -60,11 +61,12 @@ This will run a development server on port 8000. If you preview your app now you In this module, we'll create our first Django Application that will show a **Hello World** message instead of Weclome to Django. To create our application, we'll run this command inside our Django project in the console. - + cd django_blog python manage.py startapp blog -This will create a folder *blog* inside our project. The new file structure should look something like this. +This will create a folder *blog* inside our project. The new file structure should look something like this. + django_blog ├── blog │   ├── __init__.py │   ├── models.py @@ -93,14 +95,17 @@ This will create a `home` view for our application that simply returns **Hello W Let's see how this works 1. First, we import the class HttpResponse, which lives in the django.http module. We need to import this class because it’s used later in our code. +> django.http module ? What is module at the first place ? 2. We define `home` function, or `home view`. We can name this anything we want. As long as it is a valid python identifier. Every view function takes *request* as first parameter which contains details about the HTTP Request. -3. We call HTTPResponse function to display our **Hello World** message. +3. We call HttpResponse function to display our **Hello World** message. +> This HttpResponse is a function different from the HttpResponse class right ? -Now that our view is ready, we need to tell our our django project when to serve this view. If you have been following closely, you can guess. We do this in `django_blog/urls.py` +Now that our view is ready, we need to tell our django project when to serve this view. If you have been following closely, you can guess. We do this in `django_blog/urls.py` Now, add the following python code below the comment on line 8 url(r'^$', 'blog.views.home'), +> The url mapping like r'^$' needs explanation. blog.views.home is suggestive though. This shall be enough to tell our django project, to serve the home view in blog application when we visit the root url of the project. @@ -111,3 +116,5 @@ You can test the same by running development server again. That is it, preview your application and you shall see the **Hello World** message. That's it for this module. We'll get into models and get started with blog views in the next module. +> I am able to run the app, but my feedback is - isnt there an easier way to do the hello world. In Rails, we put a html file in public/ & simply render it to show hello world. +> Also, lets complete the blog app & release. From 50d80c6d73605885359d59e6e5e7eec025882b59 Mon Sep 17 00:00:00 2001 From: pocha Date: Thu, 7 Feb 2013 18:20:52 +0530 Subject: [PATCH 11/11] editing changes --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d20b68..a821ec7 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,10 @@ This will create a `home` view for our application that simply returns **Hello W Let's see how this works 1. First, we import the class HttpResponse, which lives in the django.http module. We need to import this class because it’s used later in our code. -> django.http module ? What is module at the first place ? 2. We define `home` function, or `home view`. We can name this anything we want. As long as it is a valid python identifier. Every view function takes *request* as first parameter which contains details about the HTTP Request. 3. We call HttpResponse function to display our **Hello World** message. + +> django.http module ? What is module at the first place ? > This HttpResponse is a function different from the HttpResponse class right ? Now that our view is ready, we need to tell our django project when to serve this view. If you have been following closely, you can guess. We do this in `django_blog/urls.py`