Skip to content

Commit a3a1b31

Browse files
committed
Added codeblock-filename syntax in chapters 1-8
1 parent c197762 commit a3a1b31

File tree

5 files changed

+455
-269
lines changed

5 files changed

+455
-269
lines changed

book.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
"Need help? Talk to us!": "https://gitter.im/DjangoGirls/tutorial"
55
}
66
},
7-
87
"plugins": [
9-
8+
9+
10+
11+
12+
1013
],
1114
"pluginsConfig": {
1215
"ga": {

en/django_installation/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
> **Note** If you already worked through the Installation steps then you've already done this - you can go straight to the next chapter!
44
5-
{% include "django_installation/instructions.md" %}
6-
5+
{% include "django_installation/instructions.md" %}

en/django_start_project/README.md

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ The names of some files and directories are very important for Django. You shoul
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

21-
(myvenv) ~/djangogirls$ django-admin startproject mysite .
21+
```:command-line
22+
(myvenv) ~/djangogirls$ django-admin startproject mysite .
23+
```
2224

2325
On Windows; **don't forget to add the period (or dot) `.` at the end**:
2426

25-
(myvenv) C:\Users\Name\djangogirls> django-admin startproject mysite .
27+
```:command-line
28+
(myvenv) C:\Users\Name\djangogirls> django-admin.py startproject mysite .
29+
```
2630

2731
> The period `.` is crucial because it tells the script to install Django in your current directory (for which the period `.` is a short-hand reference)
2832
@@ -32,13 +36,15 @@ of the prompt that will be inviting your input on your command line.
3236

3337
`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:
3438

35-
djangogirls
36-
├───manage.py
37-
└───mysite
38-
settings.py
39-
urls.py
40-
wsgi.py
41-
__init__.py
39+
```:command-line
40+
djangogirls
41+
├───manage.py
42+
└───mysite
43+
settings.py
44+
urls.py
45+
wsgi.py
46+
__init__.py
47+
```
4248

4349

4450
`manage.py` is a script that helps with management of the site. With it we will be able to start a web server on our computer without installing anything else, amongst other things.
@@ -58,7 +64,7 @@ It would be nice to have the correct time on our website. Go to the [wikipedia t
5864

5965
In settings.py, find the line that contains `TIME_ZONE` and modify it to choose your own timezone:
6066

61-
```python
67+
```python:settings.py
6268
TIME_ZONE = 'Europe/Berlin'
6369
```
6470

@@ -67,7 +73,7 @@ Modifying "Europe/Berlin" as appropriate
6773

6874
We'll also need to add a path for static files (we'll find out all about static files and CSS later in the tutorial). Go down to the *end* of the file, and just underneath the `STATIC_URL` entry, add a new one called `STATIC_ROOT`:
6975

70-
```python
76+
```python:settings.py
7177
STATIC_URL = '/static/'
7278
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
7379
```
@@ -79,7 +85,7 @@ There's a lot of different database software that can store data for your site.
7985

8086
This is already set up in this part of your `mysite/settings.py` file:
8187

82-
```python
88+
```python:settings.py
8389
DATABASES = {
8490
'default': {
8591
'ENGINE': 'django.db.backends.sqlite3',
@@ -90,41 +96,50 @@ DATABASES = {
9096

9197
To create a database for our blog, let's run the following in the console: `python manage.py migrate` (we need to be in the `djangogirls` directory that contains the `manage.py` file). If that goes well, you should see something like this:
9298

93-
(myvenv) ~/djangogirls$ python manage.py migrate
94-
Operations to perform:
95-
Synchronize unmigrated apps: messages, staticfiles
96-
Apply all migrations: contenttypes, sessions, admin, auth
97-
Synchronizing apps without migrations:
98-
Creating tables...
99-
Running deferred SQL...
100-
Installing custom SQL...
101-
Running migrations:
102-
Rendering model states... DONE
103-
Applying contenttypes.0001_initial... OK
104-
Applying auth.0001_initial... OK
105-
Applying admin.0001_initial... OK
106-
Applying contenttypes.0002_remove_content_type_name... OK
107-
Applying auth.0002_alter_permission_name_max_length... OK
108-
Applying auth.0003_alter_user_email_max_length... OK
109-
Applying auth.0004_alter_user_username_opts... OK
110-
Applying auth.0005_alter_user_last_login_null... OK
111-
Applying auth.0006_require_contenttypes_0002... OK
112-
Applying sessions.0001_initial... OK
99+
```:command-line
100+
(myvenv) ~/djangogirls$ python manage.py migrate
101+
Operations to perform:
102+
Synchronize unmigrated apps: messages, staticfiles
103+
Apply all migrations: contenttypes, sessions, admin, auth
104+
Synchronizing apps without migrations:
105+
Creating tables...
106+
Running deferred SQL...
107+
Installing custom SQL...
108+
Running migrations:
109+
Rendering model states... DONE
110+
Applying contenttypes.0001_initial... OK
111+
Applying auth.0001_initial... OK
112+
Applying admin.0001_initial... OK
113+
Applying contenttypes.0002_remove_content_type_name... OK
114+
Applying auth.0002_alter_permission_name_max_length... OK
115+
Applying auth.0003_alter_user_email_max_length... OK
116+
Applying auth.0004_alter_user_username_opts... OK
117+
Applying auth.0005_alter_user_last_login_null... OK
118+
Applying auth.0006_require_contenttypes_0002... OK
119+
Applying sessions.0001_initial... OK
120+
```
121+
113122

114123
And we're done! Time to start the web server and see if our website is working!
115124

116125
You need to be in the directory that contains the `manage.py` file (the `djangogirls` directory). In the console, we can start the web server by running `python manage.py runserver`:
117126

118-
(myvenv) ~/djangogirls$ python manage.py runserver
127+
```:command-line
128+
(myvenv) ~/djangogirls$ python manage.py runserver
129+
```
119130

120131
If you are on Windows and this fails with `UnicodeDecodeError`, use this command instead:
121132

122-
(myvenv) ~/djangogirls$ python manage.py runserver 0:8000
133+
```:command-line
134+
(myvenv) ~/djangogirls$ python manage.py runserver 0:8000
135+
```
123136

124137

125138
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:
126139

127-
http://127.0.0.1:8000/
140+
```:browser
141+
http://127.0.0.1:8000/
142+
```
128143

129144
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).
130145

0 commit comments

Comments
 (0)