Skip to content

Commit 9b5ec26

Browse files
committed
Merge pull request DjangoGirls#94 from JesseIrwin/master
minor changes to python intro and virtualenv instructions
2 parents 5624144 + dcbc60d commit 9b5ec26

6 files changed

Lines changed: 27 additions & 15 deletions

File tree

deploy/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Create `.gitignore` file with the following content:
126126

127127
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).
128128

129+
__NOTE:__ Remember to replace `myvenv` with the name you gave your `virtualenv`!
130+
129131
Next, we’ll create a new git repository and save our changes. Go to your console and run these commands:
130132

131133
$ git init

django_admin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Let's open the `blog/admin.py` file and replace its content with this:
1111

1212
As you can see, we import (include) the Post model defined in the previous chapter. To make our model visible on the admin page, we need to register the model with `admin.site.register(Post)`.
1313

14-
Ok, time to look at our Post model. Go to the browser and type the address:
14+
Ok, time to look at our Post model. Remember to run `python manage.py runserver` in the console to run the web server. Go to the browser and type the address:
1515

1616
http://127.0.0.1:8000/admin/
1717

django_installation/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ where `C:\Python34\python` is the directory in which you previously installed Py
3535

3636
### Linux and OS X
3737

38-
Creating a `virtualenv` on both Linux and OS X is as simple as running:
38+
Creating a `virtualenv` on both Linux and OS X is as simple as running `python3 -m venv myvenv`.
39+
It will look like this:
3940

4041
~/djangogirls$ python3 -m venv myvenv
4142

43+
and just like the Windows instructions above, `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!
4244

4345
> __NOTE:__ Initiating the virtual environment on Ubuntu 14.04 like this currently gives the following error:
4446
@@ -52,7 +54,7 @@ Creating a `virtualenv` on both Linux and OS X is as simple as running:
5254

5355
## Working with virtualenv
5456

55-
The command above will create a directory called `myvenv` that contains our virtual environment (basically bunch of directory and files). All we want to do now is starting it by running:
57+
The command above will create a directory called `myvenv` (or whichever name you chose) that contains our virtual environment (basically bunch of directory and files). All we want to do now is starting it by running:
5658

5759
C:\Users\Name\djangogirls> myvenv\Scripts\activate
5860

@@ -62,6 +64,8 @@ on Windows, or:
6264

6365
on OS X and Linux.
6466

67+
Remember to replace `myvenv` with your chosen `virtualenv` name!
68+
6569
> __NOTE:__ sometimes `source` might not be available. In those cases try doing this instead:
6670
6771
> ~/djangogirls$ . myvenv/bin/activate

django_orm/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ But what's next? To take actual blog posts from `Post` model we need something c
2424

2525
## Queryset
2626

27-
So now we are interested in a list of blog posts, right? But all we have is model `Post`. A Queryset will give us a collection we are looking for. All we need to do is:
27+
So now we are interested in a list of blog posts, right? But all we have is model `Post`. A Queryset will give us a collection we are looking for. All we need to do is use:
2828

2929
Post.objects.all()
3030

@@ -34,15 +34,15 @@ And we have our first queryset! Now we can take each element out of it and displ
3434

3535
But before we pass this queryset to the template and display blog posts we will do some magic and select only posts that are published (they have a `published_date` set).
3636

37-
This is where we introduce a `filter`. We will use it instead of `all` in a previous line of code. In parentheses we will state what condition(s) needs to be met by a blog post to end up in our queryset. In our situation it is `published_date` that is not empty. The way to write it in Django is: `published_date__isnull=False` (`null` in programming means *empty*).
37+
This is where we introduce a `filter`. We will use it instead of `all` in `Post.objects.all()`. In parentheses we will state what condition(s) needs to be met by a blog post to end up in our queryset. In our situation it is `published_date` that is not empty. The way to write it in Django is: `published_date__isnull=False` (`null` in programming means *empty*). Now our piece of code looks like:
3838

3939
Post.objects.filter(published_date__isnull=False)
4040

4141
Finally, it would be good to have our posts ordered by publish date, right? We can do that with `order_by`. In parentheses we will type (in quotation marks `''`) the name of a field (`published_date`) to order by. Our final queryset looks like this:
4242

4343
Post.objects.filter(published_date__isnull=False).order_by('published_date')
4444

45-
Time to put this piece of code inside `post_list`, right?
45+
Now we put this piece of code inside the `post_list` file, by adding it to the function `def post_list(request)`:
4646

4747
from django.shortcuts import render
4848
from .models import Post

django_start_project/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ In console you should run (remember that you don't type `(myvenv) ~/djangogirls$
1717

1818
> 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 that in __Django installation__ chapter in __Working with virtualenv__ part.
1919
20-
Run on Linux or Mac OS:
20+
Run on Windows:
2121

22-
(myvenv) ~/djangogirls$ django-admin.py startproject mysite .
22+
(myvenv) ~/djangogirls$ python myvenv\Scripts\django-admin.py startproject mysite .
2323

24-
or on Windows:
24+
or on Linux or Mac OS:
2525

26-
(myvenv) ~/djangogirls$ python myvenv\Scripts\django-admin.py startproject mysite .
26+
(myvenv) ~/djangogirls$ django-admin.py startproject mysite .
2727

2828
`django-admin.py` is a script that will create the directories and files for you. You should now have a directory structure which looks like this:
2929

@@ -46,7 +46,7 @@ Let's ignore the other files for now - we won't change them. The only thing to r
4646

4747
## Changing settings
4848

49-
Let's make some changes in `mysite/settings.py`.
49+
Let's make some changes in `mysite/settings.py`. Open the file using the code editor you installed earlier.
5050

5151
It would be nice to have the correct time on our website. Go to http://en.wikipedia.org/wiki/List_of_tz_database_time_zones and copy your relevant time zone (TZ). (eg. `Europe/Berlin` )
5252

@@ -55,6 +55,8 @@ You should find lines that contain `USE_TZ` and `TIME_ZONE` and modify them to l
5555
USE_TZ = False
5656
TIME_ZONE = 'Europe/Berlin'
5757

58+
(But with the correct country and city for your timezone.)
59+
5860
## Setup a database
5961

6062
There's a lot of different database software that can store data for your site. We'll use the default one, `sqlite3`.

python_introduction/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ Now, try writing the following command:
214214

215215
>>> django_dolls = {'Dottie' : 15, 'Lottie' : 305, 'EmmyLou' : 17}
216216

217-
Don't be surprised with the weird names. Go to the link: http://hubpages.com/hub/50-Doll-Names to look for more cute doll names. :P Just Kidding (You should do this if and only if you have a lot of time).
217+
Don't be surprised with the weird names. Go to the link: http://hubpages.com/hub/50-Doll-Names to look for more cute doll names. :P Just Kidding (You should do this if and only if you have a lot of time).
218218

219-
Above, you just created a variable named django_dolls with three key-value pairs. The key Dottie points to the value 15, Lottie points to the value 305, EmmyLou points to the value 17.
219+
Above, you just created a variable named django_dolls with three key-value pairs. The key Dottie points to the value 15, Lottie points to the value 305, EmmyLou points to the value 17.
220220

221221
When to use a dictionary or a list? Well, a good point to ponder on. Just have a soltuion in mind before looking at the answer in the next line.
222222

@@ -232,7 +232,7 @@ Like the lists, using len() method on the dictionaries, returns the number of ke
232232
>>> len(django_dolls)
233233
4
234234

235-
I hope it makes sense uptil now. :) Ready for some more fun with Dictionaries? Hop on the next line for some amazing things.
235+
I hope it makes sense uptil now. :) Ready for some more fun with Dictionaries? Hop on the next line for some amazing things.
236236

237237
You can use del() command to delete an item in the dictionary which has particular. Say, if you want to delete the entry corresponding to the key Dottie, just type in the following command:
238238

@@ -248,7 +248,7 @@ Apart from this, you can also change a value associated with an already created
248248
>>> django_dolls
249249
{'Jilly': 100, 'EmmyLou': 17, 'Lottie': 305}
250250

251-
As you can see, the value of the key 'Jilly' has been altered from 67 to 100. :) Exciting? Hurrah! You just learnt another amazing thing.
251+
As you can see, the value of the key 'Jilly' has been altered from 67 to 100. :) Exciting? Hurrah! You just learnt another amazing thing.
252252

253253
### Summary
254254

@@ -520,6 +520,10 @@ You can also use `for` on numbers using the `range` method:
520520

521521
Note that the second of these two numbers is not included in the list that is output by Python (meaning `range(1, 6)` counts from 1 to 5, but does not include the number 6).
522522

523+
## Exiting Python
524+
525+
You can exit Python and return to the command line using `exit()`.
526+
523527
## Summary
524528

525529
That's it. __You totally rock!__ This really wasn't so easy, so you should feel proud of yourself. We're definitely proud of you for making it to here!

0 commit comments

Comments
 (0)