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
> This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
5
7
> To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0/
6
8
@@ -22,6 +24,8 @@ It will (more or less) look like this:
22
24
23
25

24
26
27
+
> #### Hint
28
+
>
25
29
> If you work with the tutorial on your own and don't have a coach who will help you in case of any problem, we have a chat system for you: [](https://gitter.im/DjangoGirls/tutorial). We asked our coaches and previous attendees to be there from time to time and help others with the tutorial! Don't be afraid to ask your question there!
26
30
27
31
OK, [let's start at the beginning…](./how_the_internet_works/README.md)
> **Note** If you already worked through the Installation steps, no need to do this again – you can skip straight ahead to [Introduction to Python](../python_introduction/README.md).
3
+
> #### Note
4
+
>
5
+
> If you already worked through the Installation steps, no need to do this again – you can skip straight ahead to [Introduction to Python](../python_introduction/README.md).
> For readers at home: this chapter is covered in the [Installing Python & Code Editor](https://www.youtube.com/watch?v=pVTaqzKZCdA&t=4m43s) video.
3
+
> #### Info::For readers at home
4
+
>
5
+
> this chapter is covered in the [Installing Python & Code Editor](https://www.youtube.com/watch?v=pVTaqzKZCdA&t=4m43s) video.
4
6
5
7
You're about to write your first line of code, so it's time to download a code editor!
6
8
7
-
> **Note** If you're using a Chromebook, skip this chapter and make sure you follow the [Chromebook Setup](../chromebook_setup/README.md) instructions.
9
+
> #### Note
10
+
>
11
+
> If you're using a Chromebook, skip this chapter and make sure you follow the [Chromebook Setup](../chromebook_setup/README.md) instructions.
8
12
9
-
> **Note** You might have done this earlier in the Installation chapter – if so, you can skip right ahead to the next chapter!
13
+
14
+
15
+
> #### Note
16
+
>
17
+
> You might have done this earlier in the Installation chapter – if so, you can skip right ahead to the next chapter!
Copy file name to clipboardExpand all lines: en/deploy/README.md
+44-13Lines changed: 44 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Deploy!
2
2
3
-
> **Note** The following chapter can be sometimes a bit hard to get through. Persist and finish it; deployment is an important part of the website development process. This chapter is placed in the middle of the tutorial so that your mentor can help with the slightly trickier process of getting your website online. This means you can still finish the tutorial on your own if you run out of time.
3
+
> #### Note
4
+
>
5
+
> The following chapter can be sometimes a bit hard to get through. Persist and finish it; deployment is an important part of the website development process. This chapter is placed in the middle of the tutorial so that your mentor can help with the slightly trickier process of getting your website online. This means you can still finish the tutorial on your own if you run out of time.
4
6
5
7
Until now, your website was only available on your computer. Now you will learn how to deploy it! Deploying is the process of publishing your application on the Internet so people can finally go and see your app. :)
6
8
@@ -12,15 +14,19 @@ These three places will be important to you. Your local computer will be the pl
12
14
13
15
# Git
14
16
15
-
> **Note** If you already did the Installation steps, there's no need to do this again – you can skip to the next section and start creating your Git repository.
17
+
> #### Note
18
+
>
19
+
> If you already did the Installation steps, there's no need to do this again – you can skip to the next section and start creating your Git repository.
16
20
17
21
{% include "/deploy/install_git.md" %}
18
22
19
23
## Starting our Git repository
20
24
21
25
Git tracks changes to a particular set of files in what's called a code repository (or "repo" for short). Let's start one for our project. Open up your console and run these commands, in the `djangogirls` directory:
22
26
23
-
> **Note** Check your current working directory with a `pwd` (Mac OS X/Linux) or `cd` (Windows) command before initializing the repository. You should be in the `djangogirls` folder.
27
+
> #### Note
28
+
>
29
+
> Check your current working directory with a `pwd` (Mac OS X/Linux) or `cd` (Windows) command before initializing the repository. You should be in the `djangogirls` folder.
24
30
25
31
{% filename %}command-line{% endfilename %}
26
32
```
@@ -47,9 +53,15 @@ db.sqlite3
47
53
48
54
And save it as `.gitignore` in the "djangogirls" folder.
49
55
50
-
> **Note** The dot at the beginning of the file name is important! If you're having any difficulty creating it (Macs don't like you to create files that begin with a dot via the Finder, for example), then use the "Save As" feature in your editor; it's bulletproof.
56
+
> #### Note
57
+
>
58
+
> The dot at the beginning of the file name is important! If you're having any difficulty creating it (Macs don't like you to create files that begin with a dot via the Finder, for example), then use the "Save As" feature in your editor; it's bulletproof.
51
59
52
-
> **Note** One of the files you specified in your `.gitignore` file is `db.sqlite3`. That file is your local database, where all or your posts are stored. We don't want to add this to your repository because your website on PythonAnywhere is going to be using a different database. That database could be SQLite, like your development machine, but usually you will use one called MySQL which can deal with a lot more site visitors than SQLite. Either way, by ignoring your SQLite database for the GitHub copy, it means that all of the posts you created so far are going to stay and only be available locally, but you're going to have to add them again on production. You should think of your local database as a good playground where you can test different things and not be afraid that you're going to delete your real posts from your blog.
60
+
61
+
62
+
> #### Note
63
+
>
64
+
> One of the files you specified in your `.gitignore` file is `db.sqlite3`. That file is your local database, where all or your posts are stored. We don't want to add this to your repository because your website on PythonAnywhere is going to be using a different database. That database could be SQLite, like your development machine, but usually you will use one called MySQL which can deal with a lot more site visitors than SQLite. Either way, by ignoring your SQLite database for the GitHub copy, it means that all of the posts you created so far are going to stay and only be available locally, but you're going to have to add them again on production. You should think of your local database as a good playground where you can test different things and not be afraid that you're going to delete your real posts from your blog.
53
65
54
66
It's a good idea to use a `git status` command before `git add` or whenever you find yourself unsure of what has changed. This will help prevent any surprises from happening, such as wrong files being added or committed. The `git status` command returns information about any untracked/modified/staged files, the branch status, and much more. The output should be similar to the following:
55
67
@@ -93,7 +105,9 @@ Then, create a new repository, giving it the name "my-first-blog". Leave the "in
93
105
94
106
<imgsrc="images/new_github_repo.png" />
95
107
96
-
> **Note** The name `my-first-blog` is important – you could choose something else, but it's going to occur lots of times in the instructions below, and you'd have to substitute it each time. It's probably easier to just stick with the name `my-first-blog`.
108
+
> #### Note
109
+
>
110
+
> The name `my-first-blog` is important – you could choose something else, but it's going to occur lots of times in the instructions below, and you'd have to substitute it each time. It's probably easier to just stick with the name `my-first-blog`.
97
111
98
112
On the next screen, you'll be shown your repo's clone URL. Choose the "HTTPS" version, copy it, and we'll paste it into the terminal shortly:
99
113
@@ -130,7 +144,9 @@ Your code is now on GitHub. Go and check it out! You'll find it's in fine compa
130
144
131
145
# Setting up our blog on PythonAnywhere
132
146
133
-
> **Note** You might have already created a PythonAnywhere account earlier during the install steps – if so, no need to do it again.
147
+
> #### Note
148
+
>
149
+
> You might have already created a PythonAnywhere account earlier during the install steps – if so, no need to do it again.
134
150
135
151
{% include "/deploy/signup_pythonanywhere.md" %}
136
152
@@ -139,7 +155,9 @@ Your code is now on GitHub. Go and check it out! You'll find it's in fine compa
139
155
140
156
When you've signed up for PythonAnywhere, you'll be taken to your dashboard or "Consoles" page. Choose the option to start a "Bash" console – that's the PythonAnywhere version of a console, just like the one on your computer.
141
157
142
-
> **Note** PythonAnywhere is based on Linux, so if you're on Windows, the console will look a little different from the one on your computer.
158
+
> #### Note
159
+
>
160
+
> PythonAnywhere is based on Linux, so if you're on Windows, the console will look a little different from the one on your computer.
143
161
144
162
Let's pull down our code from GitHub and onto PythonAnywhere by creating a "clone" of our repo. Type the following into the console on PythonAnywhere (don't forget to use your GitHub username in place of `<your-github-username>`):
> **Note** The `pip install` step can take a couple of minutes. Patience, patience! But if it takes more than five minutes, something is wrong. Ask your coach.
215
+
> #### Note
216
+
>
217
+
> The `pip install` step can take a couple of minutes. Patience, patience! But if it takes more than five minutes, something is wrong. Ask your coach.
198
218
199
219
<!--TODO: think about using requirements.txt instead of pip install.-->
200
220
@@ -221,7 +241,9 @@ Click back to the PythonAnywhere dashboard by clicking on its logo, and then cli
221
241
222
242
After confirming your domain name, choose **manual configuration** (N.B. – *not* the "Django" option) in the dialog. Next choose **Python 3.5**, and click Next to finish the wizard.
223
243
224
-
> **Note** Make sure you choose the "Manual configuration" option, not the "Django" one. We're too cool for the default PythonAnywhere Django setup. ;-)
244
+
> #### Note
245
+
>
246
+
> Make sure you choose the "Manual configuration" option, not the "Django" one. We're too cool for the default PythonAnywhere Django setup. ;-)
225
247
226
248
227
249
### Setting the virtualenv
@@ -232,7 +254,9 @@ You'll be taken to the PythonAnywhere config screen for your webapp, which is wh
232
254
233
255
In the "Virtualenv" section, click the red text that says "Enter the path to a virtualenv", and enter `/home/<your-PythonAnywhere-username>/my-first-blog/myvenv/`. Click the blue box with the checkmark to save the path before moving on.
234
256
235
-
> **Note** Substitute your own PythonAnywhere username as appropriate. If you make a mistake, PythonAnywhere will show you a little warning.
257
+
> #### Note
258
+
>
259
+
> Substitute your own PythonAnywhere username as appropriate. If you make a mistake, PythonAnywhere will show you a little warning.
236
260
237
261
238
262
### Configuring the WSGI file
@@ -259,8 +283,15 @@ from django.contrib.staticfiles.handlers import StaticFilesHandler
> **Note** Don't forget to substitute in your own PythonAnywhere username where it says `<your-PythonAnywhere-username>`.
263
-
> **Note** In line four, we make sure Python anywhere knows how to find our application. It is very important that this path name is correct, and especially that there are no extra spaces here. Otherwise you will see an "ImportError" in the error log.
286
+
> #### Note
287
+
>
288
+
> Don't forget to substitute in your own PythonAnywhere username where it says `<your-PythonAnywhere-username>`.
289
+
290
+
291
+
292
+
> #### Note
293
+
>
294
+
> In line four, we make sure Python anywhere knows how to find our application. It is very important that this path name is correct, and especially that there are no extra spaces here. Otherwise you will see an "ImportError" in the error log.
264
295
265
296
This file's job is to tell PythonAnywhere where our web app lives and what the Django settings file's name is.
Copy file name to clipboardExpand all lines: en/deploy/install_git.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,9 @@ data-collapse=true ces-->
14
14
15
15
Download Git from [git-scm.com](https://git-scm.com/) and just follow the instructions.
16
16
17
-
> **Note** If you are running OS X 10.6, 10.7, or 10.8, you will need to install the version of git from here: [Git installer for OS X Snow Leopard](https://sourceforge.net/projects/git-osx-installer/files/git-2.3.5-intel-universal-snow-leopard.dmg/download)
17
+
> #### Note
18
+
>
19
+
> If you are running OS X 10.6, 10.7, or 10.8, you will need to install the version of git from here: [Git installer for OS X Snow Leopard](https://sourceforge.net/projects/git-osx-installer/files/git-2.3.5-intel-universal-snow-leopard.dmg/download)
> **Note** When choosing your username here, bear in mind that your blog's URL will take the form `yourusername.pythonanywhere.com`, so choose either your own nickname, or a name for what your blog is all about.
7
+
> #### Note
8
+
>
9
+
> When choosing your username here, bear in mind that your blog's URL will take the form `yourusername.pythonanywhere.com`, so choose either your own nickname, or a name for what your blog is all about.
Copy file name to clipboardExpand all lines: en/django_admin/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,8 @@ OK, time to look at our Post model. Remember to run `python manage.py runserver`
20
20
21
21
To log in, you need to create a *superuser* - a user account that has control over everything on the site. Go back to the command line, type `python manage.py createsuperuser`, and press enter.
22
22
23
+
> #### Note
24
+
>
23
25
> Remember, to write new commands while the web server is running, open a new terminal window and activate your virtualenv. We reviewed how to write new commands in the <b>Your first Django project!</b> chapter, in the <b>Starting the web server</b> section.
24
26
25
27
When prompted, type your username (lowercase, no spaces), email address, and password. Don't worry that you can't see the password you're typing in – that's how it's supposed to be. Just type it in and press `enter` to continue. The output should look like this (where the username and email should be your own ones):
Copy file name to clipboardExpand all lines: en/django_forms/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -251,6 +251,8 @@ You might have noticed that we are setting the publish date before saving the po
251
251
252
252
That is awesome!
253
253
254
+
> #### Info
255
+
>
254
256
> As we have recently used the Django admin interface, the system currently thinks we are still logged in. There are a few situations that could lead to us being logged out (closing the browser, restarting the DB, etc.). If, when creating a post, you find that you are getting errors referring to the lack of a logged-in user, head to the admin page http://127.0.0.1:8000/admin and log in again. This will fix the issue temporarily. There is a permanent fix awaiting you in the __Homework: add security to your website!__ chapter after the main tutorial.
> **Note** If you're using a Chromebook, skip this chapter and make sure you follow the [Chromebook Setup](../chromebook_setup/README.md) instructions.
3
+
> #### Note
4
+
>
5
+
> If you're using a Chromebook, skip this chapter and make sure you follow the [Chromebook Setup](../chromebook_setup/README.md) instructions.
4
6
5
-
> **Note** If you already worked through the Installation steps then you've already done this – you can go straight to the next chapter!
7
+
8
+
9
+
> #### Note
10
+
>
11
+
> If you already worked through the Installation steps then you've already done this – you can go straight to the next chapter!
12
+
13
+
6
14
7
15
{% include "/django_installation/instructions.md" %}
0 commit comments