Skip to content

Commit e09e4dd

Browse files
author
Paul Hallett
committed
Django installation & models chapter through hemingwayapp
1 parent 96d537a commit e09e4dd

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

en/django_installation/instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ is copyrighted by Markus Zapke-Gründemann et al.
88

99
## Virtual environment
1010

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!
1212

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?
1414

1515
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).
1616

@@ -38,7 +38,7 @@ It will look like this:
3838

3939
~/djangogirls$ python3 -m venv myvenv
4040

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!
4242

4343
> __NOTE:__ Initiating the virtual environment on Ubuntu 14.04 like this currently gives the following error:
4444
@@ -52,7 +52,7 @@ It will look like this:
5252

5353
## Working with virtualenv
5454

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:
5656

5757
C:\Users\Name\djangogirls> myvenv\Scripts\activate
5858

en/django_models/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Django models
22

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`.
44

55
## Objects
66

@@ -31,7 +31,7 @@ So basically the idea is to describe real things in code with properties (called
3131

3232
How will we model blog posts then? We want to build a blog, right?
3333

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?
3535

3636
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.
3737

@@ -47,7 +47,7 @@ What kind of things could be done with a blog post? It would be nice to have som
4747

4848
So we will need a `publish` method.
4949

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!
5151

5252
## Django model
5353

@@ -123,9 +123,9 @@ class Post(models.Model):
123123
return self.title
124124
```
125125

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").
127127
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!
129129

130130
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 ...`.
131131

@@ -142,13 +142,13 @@ Now we define the properties we were talking about: `title`, `text`, `created_da
142142
- `models.DateTimeField` - this is a date and time.
143143
- `models.ForeignKey` - this is a link to another model.
144144

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).
146146

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`.
148148

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.
150150

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!
152152

153153
### Create tables for models in your database
154154

en/django_start_project/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ is copyrighted by Markus Zapke-Gründemann et al.
99

1010
We're going to create a simple blog!
1111

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.
1313

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.
1515

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.
1818

1919
In your MacOS or Linux console you should run the following command; **don't forget to add the period (or dot) `.` at the end**:
2020

@@ -47,7 +47,7 @@ The `settings.py` file contains the configuration of your website.
4747

4848
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`.
4949

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!
5151

5252

5353
## Changing settings
@@ -122,11 +122,11 @@ If you are on Windows and this fails with `UnicodeDecodeError`, use this command
122122
(myvenv) ~/djangogirls$ python manage.py runserver 0:8000
123123

124124

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:
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:
126126

127127
http://127.0.0.1:8000/
128128

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).
130130

131131
Congratulations! You've just created your first website and run it using a web server! Isn't that awesome?
132132

0 commit comments

Comments
 (0)