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/django_installation/instructions.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,9 @@ is copyrighted by Markus Zapke-Gründemann et al.
8
8
9
9
## Virtual environment
10
10
11
-
Before we install Django, we'll get you to install an extremely useful tool that will help keep your coding environment tidy on your computer. It's possible to skip this step, but it's highly recommended not to - starting with the best possible setup will save you a lot of trouble in the future!
11
+
Before we install Django we will get you to install an extremely useful tool to help keep your coding environment tidy on your computer. It's possible to skip this step, but it's highly recommended. Starting with the best possible setup will save you a lot of trouble in the future!
12
12
13
-
So, let's create a **virtual environment** (also called a *virtualenv*). It will isolate your Python/Django setup on a per-project basis, meaning that any changes you make to one website won't affect any others you're also developing. Neat, right?
13
+
So, let's create a **virtual environment** (also called a *virtualenv*). Virtualenv will isolate your Python/Django setup on a per-project basis. This means that any changes you make to one website won't affect any others you're also developing. Neat, right?
14
14
15
15
All you need to do is find a directory in which you want to create the `virtualenv`; your home directory, for example. On Windows it might look like `C:\Users\Name\` (where `Name` is the name of your login).
16
16
@@ -38,7 +38,7 @@ It will look like this:
38
38
39
39
~/djangogirls$ python3 -m venv myvenv
40
40
41
-
`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!
41
+
`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 as you'll be referencing it a lot!
42
42
43
43
> __NOTE:__ Initiating the virtual environment on Ubuntu 14.04 like this currently gives the following error:
44
44
@@ -52,7 +52,7 @@ It will look like this:
52
52
53
53
## Working with virtualenv
54
54
55
-
The command above will create a directory called `myvenv` (or whatever name you chose) that contains our virtual environment (basically a bunch of directory and files). All we want to do now is start it by running:
55
+
The command above will create a directory called `myvenv` (or whatever name you chose). This directory contains our virtual environment (basically a bunch of directory and files). We can start it by running:
Copy file name to clipboardExpand all lines: en/django_models/README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Django models
2
2
3
-
What we want to create now is something that will store all posts in our blog. But to be able to do that we need to talk a little bit about things called `objects`.
3
+
What we want to create now is something that will store all the posts in our blog. But to be able to do that we need to talk a little bit about things called `objects`.
4
4
5
5
## Objects
6
6
@@ -31,7 +31,7 @@ So basically the idea is to describe real things in code with properties (called
31
31
32
32
How will we model blog posts then? We want to build a blog, right?
33
33
34
-
We need to answer the question: what is a blog post? What properties should it have?
34
+
We need to answer the question: What is a blog post? What properties should it have?
35
35
36
36
Well, for sure our blog post needs some text with its content and a title, right? It would be also nice to know who wrote it - so we need an author. Finally, we want to know when the post was created and published.
37
37
@@ -47,7 +47,7 @@ What kind of things could be done with a blog post? It would be nice to have som
47
47
48
48
So we will need a `publish` method.
49
49
50
-
Since we already know what we want to achieve, we can start modeling it in Django!
50
+
Since we already know what we want to achieve, let's start modeling it in Django!
51
51
52
52
## Django model
53
53
@@ -123,9 +123,9 @@ class Post(models.Model):
123
123
returnself.title
124
124
```
125
125
126
-
> Double-check that you used two undescore characters (`_`) on each side of `str`. Those are used frequently in Python and sometimes we also call them "dunder" (short for "double-underscore").
126
+
> Double-check that you use two undescore characters (`_`) on each side of `str`. This convention is used frequently in Python and sometimes we also call them "dunder" (short for "double-underscore").
127
127
128
-
It is scary, right? But no worries, we will explain what these lines mean!
128
+
It looks scary, right? But no worries we will explain what these lines mean!
129
129
130
130
All lines starting with `from` or `import` are lines that add some bits from other files. So instead of copying and pasting the same things in every file, we can include some parts with `from ... import ...`.
131
131
@@ -142,13 +142,13 @@ Now we define the properties we were talking about: `title`, `text`, `created_da
142
142
-`models.DateTimeField` - this is a date and time.
143
143
-`models.ForeignKey` - this is a link to another model.
144
144
145
-
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).
145
+
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).
146
146
147
-
What about `def publish(self):`? It is exactly our`publish` method we were talking about before. `def` means that this is a function/method and `publish` is the name of the method. You can change the name of the method, if you want. The naming 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`).
147
+
What about `def publish(self):`? It is exactly the`publish` method we were talking about before. `def` means that this is a function/method and `publish` is the name of the method. You can change the name of the method, if you want. The naming rule is that we use lowercase and underscores instead of whitespaces. For example, a method that calculates average price could be called`calculate_average_price`.
148
148
149
-
Methods very often `return` something. There is an example of that in the `__str__` method. In this scenario, when we call `__str__()` we will get a text (**string**) with a Post title.
149
+
Methods often `return` something. There is an example of that in the `__str__` method. In this scenario, when we call `__str__()` we will get a text (**string**) with a Post title.
150
150
151
-
If something is still not clear about models, feel free to ask your coach! We know it is very complicated, especially when you learn what objects and functions are at the same time. But hopefully it looks slightly less magic for you now!
151
+
If something is still not clear about models, feel free to ask your coach! We know it is complicated, especially when you learn what objects and functions are at the same time. But hopefully it looks slightly less magic for you now!
Copy file name to clipboardExpand all lines: en/django_start_project/README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,12 +9,12 @@ is copyrighted by Markus Zapke-Gründemann et al.
9
9
10
10
We're going to create a simple blog!
11
11
12
-
The first step is to start a new Django project. Basically, this means that we'll run some scripts provided by Django that will create the skeleton of a Django project for us: a bunch of directories and files that we will later use.
12
+
The first step is to start a new Django project. Basically, this means that we'll run some scripts provided by Django that will create the skeleton of a Django project for us. This is just a bunch of directories and files that we will use later.
13
13
14
-
The names of some files and directories are very important for Django. You should not rename the files that we are about to create. Moving them to a different place is also not a good idea. Django needs to maintain a certain structure in order to be able to find important things.
14
+
The names of some files and directories are very important for Django. You should not rename the files that we are about to create. Moving them to a different place is also not a good idea. Django needs to maintain a certain structure to be able to find important things.
15
15
16
-
> Remember to run everything in the virtualenv. If you don't see a prefix `(myvenv)` in your console you need to activate your virtualenv. We explained how to do that in the __Django installation__ chapter in the __Working with virtualenv__ part. You can do that by typing the following command:`myvenv\Scripts\activate` on Windows or
17
-
`myvenv/bin/activate` on Mac OS / Linux.
16
+
> Remember to run everything in the virtualenv. If you don't see a prefix `(myvenv)` in your console you need to activate your virtualenv. We explained how to do that in the __Django installation__ chapter in the __Working with virtualenv__ part. Typing`myvenv\Scripts\activate` on Windows or
17
+
`myvenv/bin/activate` on Mac OS / Linux will do this for you.
18
18
19
19
In your MacOS or Linux console you should run the following command; **don't forget to add the period (or dot) `.` at the end**:
20
20
@@ -47,7 +47,7 @@ The `settings.py` file contains the configuration of your website.
47
47
48
48
Remember when we talked about a mail carrier checking where to deliver a letter? `urls.py` file contains a list of patterns used by `urlresolver`.
49
49
50
-
Let's ignore the other files for now - we won't change them. The only thing to remember is not to delete them by accident!
50
+
Let's ignore the other files for now as we won't change them. The only thing to remember is not to delete them by accident!
51
51
52
52
53
53
## Changing settings
@@ -122,11 +122,11 @@ If you are on Windows and this fails with `UnicodeDecodeError`, use this command
Now all you need to do is check that your website is running - open your browser (Firefox, Chrome, Safari, Internet Explorer or whatever you use) and enter the address:
125
+
Now all you need to do is check that your website is running. Open your browser (Firefox, Chrome, Safari, Internet Explorer or whatever you use) and enter the address:
126
126
127
127
http://127.0.0.1:8000/
128
128
129
-
The web server will take over your command prompt until you stop it: to type more commands either open a new terminal window (and don't forget to activate your virtualenv in it too), or stop the web server by switching back to the window in which it's running and pressing CTRL+C - Control and C buttons together (on Windows, you might have to press Ctrl+Break).
129
+
The web server will take over your command prompt until you stop it. To type more commands whilst it is running open a new terminal window and activate your virtualenv. To stop the web server, switch back to the window in which it's running and pressing CTRL+C - Control and C buttons together (on Windows, you might have to press Ctrl+Break).
130
130
131
131
Congratulations! You've just created your first website and run it using a web server! Isn't that awesome?
0 commit comments