Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8014742933 |
124
docs/day0.md
124
docs/day0.md
@@ -8,9 +8,9 @@ Fortunately we can do some things to make your life easier. We can install an ID
|
||||
|
||||
(or skip to [I have a Mac](#i-have-a-mac))
|
||||
|
||||
### Install Git
|
||||
### Install Git (windows)
|
||||
|
||||
Git is a version control program, but you can think of it as your best friend in the cold, dark world of data loss. Git will make sure you don't lose progress. It lets you save your code at various stages and
|
||||
Git is a version control program, but you can think of it as your best friend in the cold, dark world of data loss. Git will make sure you don't lose progress. It lets you save your code at various stages and revert back to previous saves if you need to.
|
||||
|
||||
1. Head to <https://git-scm.com/>
|
||||
|
||||
@@ -20,7 +20,7 @@ Git is a version control program, but you can think of it as your best friend in
|
||||
|
||||
3. Run through the default install process
|
||||
|
||||
### Install Python
|
||||
### Install Python (windows)
|
||||
|
||||
1. Head to <https://www.python.org/>
|
||||
|
||||
@@ -32,83 +32,83 @@ Git is a version control program, but you can think of it as your best friend in
|
||||
|
||||

|
||||
|
||||
### Install VSCode
|
||||
### Install VSCode (windows)
|
||||
|
||||
Your most important tool as a programmer is a proper editor. It should offer you a wide selection of tools but get out of your way when you don't need it. VSCode is a great option in 2020. It has tons of extensions and support for almost every language you can throw at it.
|
||||
|
||||
1. Head to <https://code.visualstudio.com/>
|
||||
|
||||
1. Click on the download link
|
||||
2. Click on the download link
|
||||
|
||||

|
||||
|
||||
1. Run through the installer, select default options
|
||||
3. Run through the installer, select default options
|
||||
|
||||
1. Open VSCode
|
||||
4. Open VSCode
|
||||
|
||||

|
||||
|
||||
1. Uncheck "Show welcome page on startup"
|
||||
5. Uncheck "Show welcome page on startup"
|
||||
|
||||

|
||||
|
||||
1. Close out of the welcome page
|
||||
6. Close out of the welcome page
|
||||
|
||||

|
||||
|
||||
1. Open the terinal with <kbd>ctrl</kbd>+<kbd>~</kbd>
|
||||
7. Open the terinal with ++ctrl++ + ~
|
||||
|
||||
1. Click the dropdown that says `1: powershell` and click `Select Default Shell`
|
||||
8. Click the dropdown that says `1: powershell` and click `Select Default Shell`
|
||||
|
||||

|
||||
|
||||
1. Select Command Prompt
|
||||
9. Select Command Prompt
|
||||
|
||||

|
||||
|
||||
1. Kill the terminal by clicking the trash can icon
|
||||
10. Kill the terminal by clicking the trash can icon
|
||||
|
||||

|
||||
|
||||
1. Click the "extensions" button on the left to open the extensions page
|
||||
11. Click the "extensions" button on the left to open the extensions page
|
||||
|
||||

|
||||
|
||||
1. Search for "python"
|
||||
12. Search for "python"
|
||||
|
||||

|
||||
|
||||
1. Click on the first Python extension and click "install"
|
||||
13. Click on the first Python extension and click "install"
|
||||
|
||||

|
||||
|
||||
1. When the extension has finished installing, close out of the welcome window
|
||||
14. When the extension has finished installing, close out of the welcome window
|
||||
|
||||

|
||||
|
||||
1. Close out of the extension window
|
||||
15. Close out of the extension window
|
||||
|
||||

|
||||
|
||||
1. Reopen your document view by clicking the "documents" icon
|
||||
16. Reopen your document view by clicking the "documents" icon
|
||||
|
||||

|
||||
|
||||
### Create a "Projects" folder
|
||||
### Create a "Projects" folder (windows)
|
||||
|
||||
I keep all my projects in a folder called "Projects" in my home directory. On Windows this is at `C:\Users\<your username>\Projects`. Create this folder now. Bookmark it, put it in your favorites, don't lose it.
|
||||
|
||||
1. In your `Projects` folder create another folder called `my_website`
|
||||
|
||||
2. Switch to VSCode You can use <kbd>alt</kbd>+<kbd>tab</kbd> to quickly switch between windows. Press <kbd>ctrl</kbd>+<kbd>k</kbd>+<kbd>o</kbd> and select the projects/my_website folder
|
||||
2. Switch to VSCode You can use ++alt+tab++ to quickly switch between windows. Press ++ctrl++ + K + O and select the projects/my_website folder
|
||||
|
||||

|
||||
|
||||
### Create a virtual environment
|
||||
### Create a virtual environment (windows)
|
||||
|
||||
A python virtual environment is a folder that will hold your python installation for the project you're working on. You'll have a virtual environment for every project you create.
|
||||
|
||||
1. With your "my_website" folder open in VSCode open the terminal with <kbd>ctrl</kbd>+<kbd>~</kbd>
|
||||
1. With your "my_website" folder open in VSCode open the terminal with ++ctrl++ + ~
|
||||
|
||||

|
||||
|
||||
@@ -126,7 +126,7 @@ A python virtual environment is a folder that will hold your python installation
|
||||
|
||||

|
||||
|
||||
### Install Django
|
||||
### Install Django (windows)
|
||||
|
||||
Django is a pip package. Pip packages are other people's python code that you can download for free. In much the same way you downloaded VSCode and Python itself with your browser, we can download pip packages with "pip". Pip comes preinstalled with Python.
|
||||
|
||||
@@ -134,33 +134,33 @@ Django is a pip package. Pip packages are other people's python code that you ca
|
||||
|
||||

|
||||
|
||||
1. If you have a warning like above you can ignore it for now. Type `django-admin startproject config .`
|
||||
2. If you have a warning like above you can ignore it for now. Type `django-admin startproject config .`
|
||||
|
||||

|
||||
|
||||
1. Click on `manage.py`. You should see VSCode activate python extensions in the bottom left and select an interpretor. ('venv': venv) should be selected. You can ignore the message that says "linter pylint is not installed" - just close out of it.
|
||||
3. Click on `manage.py`. You should see VSCode activate python extensions in the bottom left and select an interpretor. ('venv': venv) should be selected. You can ignore the message that says "linter pylint is not installed" - just close out of it.
|
||||
|
||||

|
||||
|
||||
1. Close out of manage.py by clicking the 'x' at the top.
|
||||
4. Close out of manage.py by clicking the 'x' at the top.
|
||||
|
||||
1. Type `python manage.py runserver`
|
||||
5. Type `python manage.py runserver`
|
||||
|
||||

|
||||
|
||||
1. Open a browser and navigate to <http://localhost:8000>
|
||||
6. Open a browser and navigate to <http://localhost:8000>
|
||||
|
||||

|
||||
|
||||
1. You should see an install success page. If so, congratulations! You have successfully installed Django.
|
||||
7. You should see an install success page. If so, congratulations! You have successfully installed Django.
|
||||
|
||||
1. Stop running server by clicking in the terminal and typing <kbd>ctrl</kbd>+<kbd>C</kbd>. You have successfully completed Day 0!
|
||||
8. Stop running server by clicking in the terminal and typing ++ctrl++ + C. You have successfully completed Day 0!
|
||||
|
||||
## I have a Mac
|
||||
|
||||
### Install Git
|
||||
### Install Git (mac)
|
||||
|
||||
Git is a version control program, but you can think of it as your best friend in the cold, dark world of data loss. Git will make sure you don't lose progress. It lets you save your code at various stages and
|
||||
Git is a version control program, but you can think of it as your best friend in the cold, dark world of data loss. Git will make sure you don't lose progress. It lets you save your code at various stages and revert back to previous saves if you need to.
|
||||
|
||||
1. Head to <https://git-scm.com/>
|
||||
|
||||
@@ -170,7 +170,7 @@ Git is a version control program, but you can think of it as your best friend in
|
||||
|
||||
3. Run through the default install process
|
||||
|
||||
### Install Python
|
||||
### Install Python (mac)
|
||||
|
||||
1. Head to <https://www.python.org/>
|
||||
|
||||
@@ -182,87 +182,87 @@ Git is a version control program, but you can think of it as your best friend in
|
||||
|
||||

|
||||
|
||||
### Install VSCode
|
||||
### Install VSCode (mac)
|
||||
|
||||
Your most important tool as a programmer is a proper editor. It should offer you a wide selection of tools but get out of your way when you don't need it. VSCode is a great option in 2020. It has tons of extensions and support for almost every language you can throw at it.
|
||||
|
||||
1. Head to <https://code.visualstudio.com/>
|
||||
|
||||
1. Click on the download link
|
||||
2. Click on the download link
|
||||
|
||||

|
||||
|
||||
1. Run through the installer, select default options
|
||||
3. Run through the installer, select default options
|
||||
|
||||
1. Open VSCode
|
||||
4. Open VSCode
|
||||
|
||||

|
||||
|
||||
1. Uncheck "Show welcome page on startup"
|
||||
5. Uncheck "Show welcome page on startup"
|
||||
|
||||

|
||||
|
||||
1. Close out of the welcome page
|
||||
6. Close out of the welcome page
|
||||
|
||||

|
||||
|
||||
1. Click the "extensions" button on the left to open the extensions page
|
||||
7. Click the "extensions" button on the left to open the extensions page
|
||||
|
||||

|
||||
|
||||
1. Search for "python"
|
||||
8. Search for "python"
|
||||
|
||||

|
||||
|
||||
1. Click on the first Python extension and click "install"
|
||||
9. Click on the first Python extension and click "install"
|
||||
|
||||

|
||||
|
||||
1. When the extension has finished installing, close out of the welcome window
|
||||
10. When the extension has finished installing, close out of the welcome window
|
||||
|
||||

|
||||
|
||||
1. Close out of the extension window
|
||||
11. Close out of the extension window
|
||||
|
||||

|
||||
|
||||
1. Reopen your document view by clicking the "documents" icon
|
||||
12. Reopen your document view by clicking the "documents" icon
|
||||
|
||||

|
||||
|
||||
### Create a "Projects" folder
|
||||
### Create a "Projects" folder (mac)
|
||||
|
||||
I keep all my projects in a folder called "Projects" in my home directory. On MacOS this is at `/Users/<your username>/Projects`. Create this folder now. Bookmark it, put it in your favorites, don't lose it.
|
||||
|
||||
1. In your `Projects` folder create another folder called `my_website`
|
||||
|
||||
1. Switch to VSCode You can use <kbd>cmd</kbd>+<kbd>tab</kbd> to quickly switch between windows. Press <kbd>ctrl</kbd>+<kbd>o</kbd> and select the projects/my_website folder
|
||||
2. Switch to VSCode You can use ++cmd+tab++ to quickly switch between windows. Press ++ctrl++ + O and select the projects/my_website folder
|
||||
|
||||

|
||||
|
||||
### Create a virtual environment
|
||||
### Create a virtual environment (mac)
|
||||
|
||||
A python virtual environment is a folder that will hold your python installation for the project you're working on. You'll have a virtual environment for every project you create.
|
||||
|
||||
1. With your "my_website" folder open in VSCode open the terminal with <kbd>ctrl</kbd>+<kbd>~</kbd>
|
||||
1. With your "my_website" folder open in VSCode open the terminal with ++ctrl++ + ~
|
||||
|
||||

|
||||
|
||||
1. Type `python3 --version`
|
||||
2. Type `python3 --version`
|
||||
|
||||

|
||||
|
||||
1. If you see `Python 3.9.#` you have the correct version, if you see another version try typing `python3.9 --version`. If that doesn't work you'll need to reinstall python 3.9.
|
||||
3. If you see `Python 3.9.#` you have the correct version, if you see another version try typing `python3.9 --version`. If that doesn't work you'll need to reinstall python 3.9.
|
||||
|
||||
1. Type `python3 -m venv venv`. You'll see a folder appear on the left side of VSCode.
|
||||
4. Type `python3 -m venv venv`. You'll see a folder appear on the left side of VSCode.
|
||||
|
||||

|
||||
|
||||
1. Source your venv: type `source venv/bin/activate`. You'll see a (venv) appear next to your terminal cursor.
|
||||
5. Source your venv: type `source venv/bin/activate`. You'll see a (venv) appear next to your terminal cursor.
|
||||
|
||||

|
||||
|
||||
### Install Django
|
||||
### Install Django (mac)
|
||||
|
||||
Django is a pip package. Pip packages are other people's python code that you can download for free. In much the same way you downloaded VSCode and Python itself with your browser, we can download pip packages with "pip". Pip comes preinstalled with Python.
|
||||
|
||||
@@ -270,24 +270,24 @@ Django is a pip package. Pip packages are other people's python code that you ca
|
||||
|
||||

|
||||
|
||||
1. If you have a warning like above you can ignore it for now. Type `django-admin startproject config .`
|
||||
2. If you have a warning like above you can ignore it for now. Type `django-admin startproject config .`
|
||||
|
||||

|
||||
|
||||
1. Click on `manage.py`. You should see VSCode activate python extensions in the bottom left and select an interpretor. ('venv': venv) should be selected. You can ignore the message that says "linter pylint is not installed" - just close out of it.
|
||||
3. Click on `manage.py`. You should see VSCode activate python extensions in the bottom left and select an interpretor. ('venv': venv) should be selected. You can ignore the message that says "linter pylint is not installed" - just close out of it.
|
||||
|
||||

|
||||
|
||||
1. Close out of manage.py by clicking the 'x' at the top.
|
||||
4. Close out of manage.py by clicking the 'x' at the top.
|
||||
|
||||
1. Type `python manage.py runserver`
|
||||
5. Type `python manage.py runserver`
|
||||
|
||||

|
||||
|
||||
1. Open a browser and navigate to <http://localhost:8000>
|
||||
6. Open a browser and navigate to <http://localhost:8000>
|
||||
|
||||

|
||||
|
||||
1. You should see an install success page. If so, congratulations! You have successfully installed Django.
|
||||
7. You should see an install success page. If so, congratulations! You have successfully installed Django.
|
||||
|
||||
1. Stop running server by clicking in the terminal and typing <kbd>ctrl</kbd>+<kbd>C</kbd>. You have successfully completed Day 0!
|
||||
8. Stop running server by clicking in the terminal and typing ++ctrl++ + C. You have successfully completed Day 0!
|
||||
|
||||
77
docs/day1.md
77
docs/day1.md
@@ -72,22 +72,21 @@ Before we can dive into our web project we have to cover some Python basics. Let
|
||||
|
||||

|
||||
|
||||
|
||||
1. In this file type `print('hello, world!')` and save with <kbd>ctrl</kbd>+<kbd>S</kbd>
|
||||
2. In this file type `print('hello, world!')` and save with ++ctrl++ + S
|
||||
|
||||

|
||||
|
||||
1. In the terminal type `python my_program.py` and press enter. You should see `hello, world!` printed to the terminal.
|
||||
3. In the terminal type `python my_program.py` and press enter. You should see `hello, world!` printed to the terminal.
|
||||
|
||||

|
||||
|
||||
1. Congratulations! You ran your first python file. Just like the python command prompt above, running `python <filename>` on a file with python code in it will execute that python code. Now we can run multiple lines of python at once!
|
||||
4. Congratulations! You ran your first python file. Just like the python command prompt above, running `python <filename>` on a file with python code in it will execute that python code. Now we can run multiple lines of python at once!
|
||||
|
||||
1. Below `print('hello, world!')` type `print('goodbye!)`
|
||||
5. Below `print('hello, world!')` type `print('goodbye!)`
|
||||
|
||||

|
||||
|
||||
1. Below `print('goodbye')` type
|
||||
6. Below `print('goodbye')` type
|
||||
|
||||
```python
|
||||
x = 1
|
||||
@@ -99,7 +98,7 @@ Before we can dive into our web project we have to cover some Python basics. Let
|
||||
|
||||

|
||||
|
||||
1. Save the file with <kbd>ctrl</kbd>+<kbd>S</kbd>. In your terminal type `python myprogram.py` and press enter. You should see
|
||||
7. Save the file with ++ctrl++ + S. In your terminal type `python myprogram.py` and press enter. You should see
|
||||
|
||||
```bash
|
||||
hello, world!
|
||||
@@ -110,29 +109,29 @@ Before we can dive into our web project we have to cover some Python basics. Let
|
||||
|
||||
printed to the terminal
|
||||
|
||||
1. This is out of order. We want to print "goodbye" last. Let's fix that with functions.
|
||||
8. This is out of order. We want to print "goodbye" last. Let's fix that with functions.
|
||||
|
||||
1. Above `print('hello, world!')` type `def print_hello():`
|
||||
9. Above `print('hello, world!')` type `def print_hello():`
|
||||
|
||||

|
||||
|
||||
1. Indent `print('hello, world!')` by pressing <kbd>tab</kbd>
|
||||
10. Indent `print('hello, world!')` by pressing ++tab++
|
||||
|
||||

|
||||
|
||||
1. Give 'goodbye' the same treatment. This time type `def print_goodbye():`
|
||||
11. Give 'goodbye' the same treatment. This time type `def print_goodbye():`
|
||||
|
||||

|
||||
|
||||
1. Finally add `def middle_stuff():` above the remaining cod
|
||||
12. Finally add `def middle_stuff():` above the remaining cod
|
||||
|
||||

|
||||
|
||||
1. Save the file with <kbd>ctrl</kbd>+<kbd>S</kbd>. Now type `python my_program.py` in the terminal and press enter. Nothing will return.
|
||||
13. Save the file with ++ctrl++ + S. Now type `python my_program.py` in the terminal and press enter. Nothing will return.
|
||||
|
||||

|
||||
|
||||
1. We've given our snippets of code "names" by adding a "def" above them. These are called functions. We can call them in any order we want. Let's call them in the correct order by using their names. Add the following to the bottom of my_program.py
|
||||
14. We've given our snippets of code "names" by adding a "def" above them. These are called functions. We can call them in any order we want. Let's call them in the correct order by using their names. Add the following to the bottom of my_program.py
|
||||
|
||||
```python
|
||||
print_hello()
|
||||
@@ -140,7 +139,7 @@ Before we can dive into our web project we have to cover some Python basics. Let
|
||||
print_goodbye()
|
||||
```
|
||||
|
||||
1. Type `python my_program.py` in the terminal and press enter. Now everything prints in order!
|
||||
15. Type `python my_program.py` in the terminal and press enter. Now everything prints in order!
|
||||
|
||||

|
||||
|
||||
@@ -150,69 +149,71 @@ Now that we can write some basic python we can begin our django project. Let's s
|
||||
|
||||
1. Close out of my_program.py
|
||||
|
||||
1. In the terminal type `django-admin startapp mysite`
|
||||
2. In the terminal type `django-admin startapp mysite`
|
||||
|
||||

|
||||
|
||||
1. Expand the `config` folder by clicking on it
|
||||
3. Expand the `config` folder by clicking on it
|
||||
|
||||

|
||||
|
||||
1. Click on `settings.py` to open it
|
||||
4. Click on `settings.py` to open it
|
||||
|
||||
1. Scroll down to line 33 and add `mysite` above `'django.contrib.admin'`
|
||||
5. Scroll down to line 33 and add `mysite` above `'django.contrib.admin'`
|
||||
|
||||

|
||||
|
||||
1. Save with <kbd>ctrl</kbd>+<kbd>S</kbd>
|
||||
6. Save with ++ctrl++ + S
|
||||
|
||||
1. Click on `urls.py` to open it
|
||||
7. Click on `urls.py` to open it
|
||||
|
||||

|
||||
|
||||
1. On line 17 add `, include` after `from django.urls import path`
|
||||
8. On line 17 add `, include` after `from django.urls import path`
|
||||
|
||||

|
||||
|
||||
1. Add `path('', include('mysite.urls')),` above `path('admin/', admin.site.urls),`
|
||||
9. Add `path('', include('mysite.urls')),` above `path('admin/', admin.site.urls),`
|
||||
|
||||

|
||||
|
||||
1. Expand the newly created `mysite` folder by clicking on it
|
||||
10. Expand the newly created `mysite` folder by clicking on it
|
||||
|
||||

|
||||
|
||||
1. Right click on `mysite` and click "New Folder". Name it `templates`
|
||||
11. Right click on `mysite` and click "New Folder". Name it `templates`
|
||||
|
||||

|
||||
|
||||
1. Right click on `templates` and click "New Folder". Name it `mysite`
|
||||
12. Right click on `templates` and click "New Folder". Name it `mysite`
|
||||
|
||||

|
||||
|
||||
1. Right click on the `mysite` folder inside `templates` and click "New File". Name it `index.html`
|
||||
13. Right click on the `mysite` folder inside `templates` and click "New File". Name it `index.html`
|
||||
|
||||

|
||||
|
||||
1. Open `index.html` by clicking on it
|
||||
14. Open `index.html` by clicking on it
|
||||
|
||||
1. Add the following to index.html
|
||||
15. Add the following to index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
|
||||
<body>
|
||||
{{ data }}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
```
|
||||
|
||||

|
||||
|
||||
1. Save with <kbd>ctrl</kbd>+<kbd>S</kbd>
|
||||
16. Save with ++ctrl++ + S
|
||||
|
||||
1. Open `views.py` by clicking on it
|
||||
17. Open `views.py` by clicking on it
|
||||
|
||||
1. In views.py under line 3 add the following:
|
||||
18. In views.py under line 3 add the following:
|
||||
|
||||
```python
|
||||
def index(request):
|
||||
@@ -225,13 +226,13 @@ Now that we can write some basic python we can begin our django project. Let's s
|
||||
|
||||

|
||||
|
||||
1. Save with <kbd>ctrl</kbd>+<kbd>S</kbd>
|
||||
19. Save with ++ctrl++ + S
|
||||
|
||||
1. Right click on `mysite` and click "New File". Name it `urls.py`
|
||||
20. Right click on `mysite` and click "New File". Name it `urls.py`
|
||||
|
||||

|
||||
|
||||
1. Add the following to urls.py:
|
||||
21. Add the following to urls.py:
|
||||
|
||||
```python
|
||||
from django.urls import path
|
||||
@@ -244,13 +245,13 @@ Now that we can write some basic python we can begin our django project. Let's s
|
||||
|
||||

|
||||
|
||||
1. Save with <kbd>ctrl</kbd>+<kbd>S</kbd>
|
||||
22. Save with ++ctrl++ + S
|
||||
|
||||
1. In the terminal type `python manage.py runserver`
|
||||
23. In the terminal type `python manage.py runserver`
|
||||
|
||||

|
||||
|
||||
1. In your browser navigate to <http://localhost:8000>
|
||||
24. In your browser navigate to <http://localhost:8000>
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -5,3 +5,8 @@ nav:
|
||||
- Day 1: day1.md
|
||||
theme:
|
||||
name: material
|
||||
markdown_extensions:
|
||||
- pymdownx.keys
|
||||
- pymdownx.superfences
|
||||
- pymdownx.highlight:
|
||||
linenums_style: pymdownx.inline
|
||||
Reference in New Issue
Block a user