You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/deploy/README.md
+28-1
Original file line number
Diff line number
Diff line change
@@ -129,10 +129,15 @@ Create a file named `.gitignore` in your `djangogirls` directory with the follow
129
129
staticfiles
130
130
local_settings.py
131
131
db.sqlite3
132
+
*.py[co]
132
133
133
134
and save it. The dot on the beginning of the file name is important! As you can see, we're now telling Heroku to ignore `local_settings.py` and don't download it, so it's only available on your computer (locally).
134
135
135
-
Next, we’ll create a new git repository and save our changes. Go to your console and run these commands:
136
+
Next, we’ll create a new git repository and save our changes.
137
+
138
+
> __Note__: Check out your current working directory with a `pwd` command before initializing the repository. You should be in the `djangogirls` folder.
139
+
140
+
Go to your console and run these commands:
136
141
137
142
$ git init
138
143
Initialized empty Git repository in ~/djangogirls/.git/
@@ -141,6 +146,28 @@ Next, we’ll create a new git repository and save our changes. Go to your conso
141
146
142
147
Initializing the git repository is something we only need to do once per project.
143
148
149
+
It's a good idea to use a `git status` command before `git add` or whenever you find yourself unsure of what will be done, to prevent any surprises from happening (e.g. wrong files will be added or commited). The `git status` command returns information about any untracked/modifed/staged files, branch status and much more. The output should be similar to:
150
+
151
+
$ git status
152
+
On branch master
153
+
154
+
Initial commit
155
+
156
+
Untracked files:
157
+
(use "git add <file>..." to include in what will be committed)
158
+
159
+
.gitignore
160
+
Procfile
161
+
mysite/__init__.py
162
+
mysite/settings.py
163
+
mysite/urls.py
164
+
mysite/wsgi.py
165
+
manage.py
166
+
requirements.txt
167
+
runtime.txt
168
+
169
+
nothing added to commit but untracked files present (use "git add" to track)
170
+
144
171
And finally we save our changes. Go to your console and run these commands:
Copy file name to clipboardExpand all lines: en/django_admin/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Make sure that at least two or three posts (but not all) have the publish date s
34
34
35
35

36
36
37
-
If you want to know more about Django admin, you should check Django's documentation: https://docs.djangoproject.com/en/1.7/ref/contrib/admin/
37
+
If you want to know more about Django admin, you should check Django's documentation: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/
38
38
39
39
This is probably a good moment to grab a coffee (or tea) or something to eat to re-energise yourself. You created your first Django model - you deserve a little timeout!
where `C:\Python34\python` is the directory in which you previously installed Python and `myvenv` is the name of your `virtualenv`. You can use any other name, but stick to lowercase and use no spaces. It is also good idea to keep the name short - you'll be referencing it a lot!
34
+
where `C:\Python34\python` is the directory in which you previously installed Python and `myvenv` is the name of your `virtualenv`. You can use any other name, but stick to lowercase and use no spaces, accents or special characters. It is also good idea to keep the name short - you'll be referencing it a lot!
35
35
36
36
### Linux and OS X
37
37
@@ -88,16 +88,16 @@ OK, we have all important dependencies in place. We can finally install Django!
88
88
89
89
## Installing Django
90
90
91
-
Now that you have your `virtualenv` started, you can install Django using `pip`. In the console, run `pip install django==1.7.7` (note that we use a double equal sign: `==`).
91
+
Now that you have your `virtualenv` started, you can install Django using `pip`. In the console, run `pip install django==1.8` (note that we use a double equal sign: `==`).
92
92
93
-
(myvenv) ~$ pip install django==1.7.7
94
-
Downloading/unpacking django==1.7.7
93
+
(myvenv) ~$ pip install django==1.8
94
+
Downloading/unpacking django==1.8
95
95
Installing collected packages: django
96
96
Successfully installed django
97
97
Cleaning up...
98
98
99
99
on Windows
100
-
> If you get an error when calling pip on Windows platform please check if your project pathname contains spaces(i.e. `C:\Users\User Name\djangogirls`). If it does please consider moving it to another place without spaces (suggestion is: `C:\djangogirls`). After the move please try the above command again.
100
+
> If you get an error when calling pip on Windows platform please check if your project pathname contains spaces, accents or special characters (i.e. `C:\Users\User Name\djangogirls`). If it does please consider moving it to another place without spaces, accents or special characters (suggestion is: `C:\djangogirls`). After the move please try the above command again.
101
101
102
102
on Linux
103
103
> If you get an error when calling pip on Ubuntu 12.04 please run `python -m pip install -U --force-reinstall pip` to fix the pip installation in the virtualenv.
Copy file name to clipboardExpand all lines: en/django_models/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ Now we define properties we were talking about: `title`, `text`, `created_date`,
137
137
-`models.DateTimeField` - this is a date and time.
138
138
-`models.ForeignKey` - this is a link to another model.
139
139
140
-
We will not explain every bit of code here, since it would take too much time. You should take a look at Django's documentation, if you want to know more about Model fields and how to define things other than those described above (https://docs.djangoproject.com/en/1.7/ref/models/fields/#field-types).
140
+
We will not explain every bit of code here, since it would take too much time. You should take a look at Django's documentation, if you want to know more about Model fields and how to define things other than those described above (https://docs.djangoproject.com/en/1.8/ref/models/fields/#field-types).
141
141
142
142
What about `def publish(self):`? It is exactly our `publish` method we were talking about before. `def` means that this is a function/method. `publish` is the name of the method. You can change it, if you want. The rule is that we use lowercase and underscores instead of whitespaces (i.e. if you want to have a method that calculates average price you could call it `calculate_average_price`).
Copy file name to clipboardExpand all lines: en/django_urls/README.md
+10-10
Original file line number
Diff line number
Diff line change
@@ -14,16 +14,16 @@ Every page on the Internet needs its own URL. This way your application knows wh
14
14
15
15
Let's open up the `mysite/urls.py` file and see what it looks like:
16
16
17
-
from django.conf.urls import patterns, include, url
17
+
from django.conf.urls import include, url
18
18
from django.contrib import admin
19
19
20
-
urlpatterns = patterns('',
20
+
urlpatterns = [
21
21
# Examples:
22
22
# url(r'^$', 'mysite.views.home', name='home'),
23
23
# url(r'^blog/', include('blog.urls')),
24
24
25
25
url(r'^admin/', include(admin.site.urls)),
26
-
)
26
+
]
27
27
28
28
As you can see, Django already put something here for us.
29
29
@@ -52,30 +52,30 @@ Go ahead, delete the commented lines (lines starting with `#`) and add a line th
52
52
53
53
Your `mysite/urls.py` file should now look like this:
54
54
55
-
from django.conf.urls import patterns, include, url
55
+
from django.conf.urls import include, url
56
56
from django.contrib import admin
57
57
58
-
urlpatterns = patterns('',
58
+
urlpatterns = [
59
59
url(r'^admin/', include(admin.site.urls)),
60
60
url(r'', include('blog.urls')),
61
-
)
61
+
]
62
62
63
63
Django will now redirect everything that comes into 'http://127.0.0.1:8000/' to `blog.urls` and look for further instructions there.
64
64
65
65
## blog.urls
66
66
67
67
Create a new `blog/urls.py` empty file. All right! Add these two first lines:
68
68
69
-
from django.conf.urls import patterns, include, url
69
+
from django.conf.urls import include, url
70
70
from . import views
71
71
72
72
Here we're just importing Django's methods and all of our `views` from `blog` application (we don't have any yet, but we will get to that in a minute!)
73
73
74
74
After that, we can add our first URL pattern:
75
75
76
-
urlpatterns = patterns('',
76
+
urlpatterns = [
77
77
url(r'^$', views.post_list),
78
-
)
78
+
]
79
79
80
80
As you can see, we're now assigning a `view` called `post_list` to `^$` URL. But what does `^$` mean? It's a regex magic :) Let's break it down:
81
81
-`^` in regex means "the beginning"; from this sign we can start looking for our pattern
@@ -91,4 +91,4 @@ There is no "It works" anymore, huh? Don't worry, it's just an error page, nothi
91
91
92
92
You can read that there is __no attribute 'post_list'__. Is *post_list* reminding you of anything? This is how we called our view! This means that everything is in place, we just didn't create our *view* yet. No worries, we will get there.
93
93
94
-
> If you want to know more about Django URLconfs, look at the official documentation: https://docs.djangoproject.com/en/1.7/topics/http/urls/
94
+
> If you want to know more about Django URLconfs, look at the official documentation: https://docs.djangoproject.com/en/1.8/topics/http/urls/
Copy file name to clipboardExpand all lines: en/extend_your_application/README.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -44,13 +44,13 @@ Let's create a URL in `urls.py` for our `post_detail` *view*!
44
44
45
45
We want to create a URL to point Django to a *view* called `post_detail`, that will show an entire blog post. Add the line `url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail),` to the `blog/urls.py` file. It should look like this:
46
46
47
-
from django.conf.urls import patterns, include, url
Copy file name to clipboardExpand all lines: en/html/README.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ A Django template's format is described in a language called HTML (that's the HT
10
10
11
11
HTML is a simple code that is interpreted by your web browser - such as Chrome, Firefox or Safari - to display a webpage for the user.
12
12
13
-
HTML stands for "HyperText Markup Language."__HyperText__ means it's a type of text that supports hyperlinks between pages. __Markup__ means we have taken a document and marked it up with code to tell something (in this case, a browser) how to interpret the page. HTML code is built with __tags__, each one starting with `<` and ending with `>`. These tags markup __elements__.
13
+
HTML stands for "HyperText Markup Language".__HyperText__ means it's a type of text that supports hyperlinks between pages. __Markup__ means we have taken a document and marked it up with code to tell something (in this case, a browser) how to interpret the page. HTML code is built with __tags__, each one starting with `<` and ending with `>`. These tags markup __elements__.
14
14
15
15
## Your first template!
16
16
@@ -28,7 +28,7 @@ And now create a `post_list.html` file (just leave it blank for now) inside the
28
28
29
29
See how your website looks now: http://127.0.0.1:8000/
30
30
31
-
> If you still have an error `TemplateDoesNotExists`, try to restart your server. Go into command line, stop the reserver by pressing Ctrl+C (Control and C buttons together) and start it again by running a `python manage.py runserver` command.
31
+
> If you still have an error `TemplateDoesNotExists`, try to restart your server. Go into command line, stop the server by pressing Ctrl+C (Control and C buttons together) and start it again by running a `python manage.py runserver` command.
32
32
33
33

34
34
@@ -125,7 +125,7 @@ Here's an example of a full template:
125
125
126
126
We've created three `div` sections here.
127
127
128
-
- The first `div` element contains the title of our blogpost - it's a heading and a link
128
+
- The first `div` element contains the title of our blog - it's a heading and a link
129
129
- Another two `div` elements contain our blogposts with a published date, `h2` with a post title that is clickable and two `p`s (paragraph) of text, one for the date and one for our blogpost.
130
130
131
131
It gives us this effect:
@@ -134,7 +134,7 @@ It gives us this effect:
134
134
135
135
Yaaay! But so far, our template only ever displays exactly __the same information__ - whereas earlier we were talking about templates as allowing us to display __different__ information in the __same format__.
136
136
137
-
What we want really want to do is display real posts added in our Django admin - and that's where we're going next.
137
+
What we really want to do is display real posts added in our Django admin - and that's where we're going next.
Copy file name to clipboardExpand all lines: en/whats_next/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ After that make sure to:
15
15
Yes! First, go ahead and try our other book, called [Django Girls Tutorial: Extensions](http://djangogirls.gitbooks.io/django-girls-tutorial-extensions/).
16
16
17
17
Later on, you can try recources listed below. They're all very recommended!
18
-
-[Django's official tutorial](https://docs.djangoproject.com/en/1.7/intro/tutorial01/)
18
+
-[Django's official tutorial](https://docs.djangoproject.com/en/1.8/intro/tutorial01/)
Copy file name to clipboardExpand all lines: es/deploy/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -140,7 +140,7 @@ Crea un fichero llamado `.gitignore` en tu directorio `djangogirls` con el sigui
140
140
staticfiles
141
141
local_settings.py
142
142
db.sqlite3
143
-
143
+
*.py[co]
144
144
145
145
y guarda los cambios. El punto al principio del nombre del fichero es importante! Como puedes ver, ahora le estamos diciendo a Heroku que ignore el fichero `local_settings.py` y no lo descargue, para que esté disponible solamente en tu ordenador (en local).
146
146
@@ -234,4 +234,4 @@ El error que veías era debido a que cuando desplegamos en Heroku creamos una nu
234
234
$ heroku run python manage.py createsuperuser
235
235
236
236
237
-
Ahora deberías poder acceder a tu sitio web desde el navegador! Felicidades :)!
237
+
Ahora deberías poder acceder a tu sitio web desde el navegador! Felicidades :)!
Copy file name to clipboardExpand all lines: es/django_installation/README.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -93,10 +93,10 @@ Tenemos todas las dependencias importantes en su lugar. ¡Finalmente podemos ins
93
93
94
94
## Instalar Django
95
95
96
-
Ahora que tienes tu `virtualenv` iniciado, puedes instalar Django usando `pip`. En la consola, ejecuta `pip install django == 1.7.1` (fíjate que utilizamos un doble signo igual): `==`).
96
+
Ahora que tienes tu `virtualenv` iniciado, puedes instalar Django usando `pip`. En la consola, ejecuta `pip install django == 1.8` (fíjate que utilizamos un doble signo igual): `==`).
97
97
98
-
(myvenv) ~$ pip install django==1.7.1
99
-
Downloading/unpacking django==1.7.1
98
+
(myvenv) ~$ pip install django==1.8
99
+
Downloading/unpacking django==1.8
100
100
Installing collected packages: django
101
101
Successfully installed django
102
102
Cleaning up...
@@ -110,4 +110,4 @@ en Linux
110
110
111
111
> Si obtienes un error al correr pip en Ubuntu 12.04 ejecuta `python -m pip install- U - force-resintall pip` para arreglar la instalación de pip en el virtualenv.
112
112
113
-
¡Eso es todo. Ahora estás listo (por fin) para crear una aplicación Django! Pero para hacer eso, necesitas un buen programa en el cual escribir código...
113
+
¡Eso es todo. Ahora estás listo (por fin) para crear una aplicación Django! Pero para hacer eso, necesitas un buen programa en el cual escribir código...
0 commit comments