Skip to content

Commit d4eb6e9

Browse files
authored
Merge pull request #64 from tecladocode/develop
2 parents 3380640 + 73069fd commit d4eb6e9

File tree

1,072 files changed

+57012
-2829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,072 files changed

+57012
-2829
lines changed

.flake8

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 88
3+
exclude = .git,__pycache__
4+
max-complexity = 10

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ __pycache__/
55
*.db
66
.DS_Store
77
venv/
8-
.venv/
8+
.venv/
9+
docs/docs/.nota/config.ini

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Flask-Smorest Docker"]
2+
path = project/using-flask-smorest-docker
3+
url = https://github.com/tecladocode/rest-api-smorest-docker

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10.0

.templates/lecture.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: The lecture title goes here
3+
description: A brief description of the lecture goes here.
4+
---
5+
6+
- [ ] Set metadata above
7+
- [ ] Start writing!
8+
- [ ] Create `start` folder
9+
- [ ] Create `end` folder
10+
- [ ] Write TL;DR
11+
- [ ] Create per-file diff between `end` and `start` (use "Compare Folders")
12+
13+
14+
15+
# Lecture Title
16+
17+

.templates/section.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: "Section name here"
3+
---
4+
5+
# Section name here
6+
7+
Description of the section goes here.

CONTRIBUTING.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# How to contribute to this course
2+
3+
## E-book contributions
4+
5+
### How to run the e-book
6+
7+
Clone the repo and navigate to the `docs` folder.
8+
9+
There, run:
10+
11+
```
12+
npm install
13+
```
14+
15+
Then you can run the e-book with:
16+
17+
```
18+
npm run start
19+
```
20+
21+
If you make any changes to the e-book, please keep changes as simple as possible and create a PR with your changes into the `develop` branch.
22+
23+
If you are making larger changes, please create a Discussion first and let's talk about it!
24+
25+
### Making changes to projects
26+
27+
All the finished projects that we cover in the course are in the `projects` folder. Making changes to these projects is done very carefully, especially after recording.
28+
29+
Please start a Discussion before making any changes, as doing so can make the experience for students confusing (if the videos and e-book are different).

README.md

+19-31
Original file line numberDiff line numberDiff line change
@@ -36,54 +36,42 @@ If you do this for the entire course, I guarantee you will learn how to make RES
3636

3737
## Section 2: A Full Python Refresher
3838

39-
The code is in files numbered between 1 and 11, covering concepts ranging from beginner to advanced.
40-
41-
1. Variables
42-
2. Methods
43-
3. Lists, tuples, and sets
44-
4. If statements
45-
5. List comprehension
46-
6. Dictionaries
47-
7. Classes and objects
48-
8. Static and class methods
49-
9. Args and Kwargs
50-
10. Passing functions as arguments
51-
11. Decorators
39+
This section (only available on Udemy) helps programmers who are new to Python get acquainted with the language. It is not a complete-beginner Python course!
5240

5341
## Section 3: Your first REST API
5442

55-
The code in this section includes a simple Flask app and a HTML and JavaScript file which calls the Flask app endpoints.
43+
The code in this section includes a simple Flask app that accepts and returns JSON data.
5644

57-
## Section 4: Flask-RESTful
45+
## Section 4: Docker
5846

59-
The code in this section includes a Flask app which is an API that represents items. It also includes user registration and authentication.
47+
Introduction to Docker to run your REST APIs. We talk about images, containers, and how to run applications.
6048

61-
We also introduce Flask-RESTful, which is a Flask extension that helps us develop APIs more easily.
49+
## Section 5: Flask-Smorest
6250

63-
## Section 5: Working with SQL
64-
65-
The code in this section extends the last section by adding persistent storage of Items to a SQLite database.
51+
We introduce the Flask-Smorest extension, a library that greatly simplifies writing REST APIs using Flask. It also provides things like automated documentation generation.
6652

6753
## Section 6: Flask-SQLAlchemy
6854

69-
The code in this section extends the previous section by replacing the manual integration with SQLite, with SQLAlchemy—an ORM (Object-Relational Mapping)—which allows us to easily replace SQLite with something like PostgreSQL or MySQL.
55+
The code in this section extends the previous section by replacing the data storage in Python lists with SQLAlchemy, an ORM (Object-Relational Mapping which simplifies connecting to and interacting with a database.
56+
57+
## Section 7: Many-to-many relationships
7058

71-
## Section 7: Git for version control
59+
In this section we talk about many-to-many relationships using SQLAlchemy.
7260

73-
In this section we introduce Git, a tool for code sharing and collaboration. In this course we'll use it to store the application code and then send it to our deployment tools, Heroku and DigitalOcean.
61+
## Section 8: Authentication with Flask-JWT-Extended
7462

75-
## Section 8: Deploying Flask Apps to Heroku
63+
Learn how to perform user authentication using JWTs and the Flask-JWT-Extended library. Here we talk about access token JWTs, as well as refresh tokens, JWT claims, blocklists, password hashing, and more.
7664

77-
Learn how to use GitHub and Heroku to deploy your Flask applications and make them available publicly to your users.
65+
## Section 9: Flask-Migrate
7866

79-
## Section 9: Deploying Flask Apps to our own servers
67+
After deploying your apps, making changes to the database can be really tricky because you have to log in to the database server and manually update the database tables using SQL commands.
8068

81-
Learn how to rent a server using DigitalOcean and run our Flask app in it. This is an alternative to Heroku. It's much cheaper, but requires a lot more work to get it set up.
69+
Flask-Migrate and the Alembic libraries simplify this job by creating migration scripts.
8270

83-
## Section 10: Security in your REST APIs
71+
## Section 10: Git Crash Course
8472

85-
In this section we learn about https and how to enable it in your own server running with DigitalOcean.
73+
A quick and intense course on Git and GitHub for code sharing.
8674

87-
## Section 11: Token Refreshing and Flask-JWT-Extended
75+
## Section 11: Deploying to Render.com
8876

89-
Learn about token freshness and how to implement refresh tokens using Flask-JWT-Extended.
77+
Learn how to get your code running in the cloud and make it publicly accessible. In this section we use Render.com for deployments and we also deploy a PostgreSQL database.

docs/.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ npm install
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ npm run start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ npm run build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true npm run deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> npm run deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

docs/babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Project overview
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Flask-Smorest for more efficient development
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Use Celery for Background Tasks",
3+
"position": 12
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Curriculum overview
3+
description: A brief description of the lecture goes here.
4+
---
5+
6+
# Curriculum overview
7+
8+
The curriculum overview goes here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: How to install Python
3+
description: A brief description of the lecture goes here.
4+
---
5+
6+
# How to install Python on your computer
7+
8+
In this lecture I'll guide you through installing Python on your computer. If have already installed Python, feel free to skip to the next lecture!
9+
10+
## On Windows
11+
12+
To install Python, download the latest version of Python from https://www.python.org. At the time of writing, that was Python 3.10.4.
13+
14+
:::caution Add to PATH
15+
As you go through the installer, make sure to check "Add Python to PATH".
16+
:::
17+
18+
Once Python is installed, you can execute the program `cmd.exe`. This is a command-line interface to your computer. Here, just type the word `python` and that will start the Python program.
19+
20+
At all points during the course, you can always type `python name_of_file.py` and that will execute the code of a file called `name_of_file.py`
21+
22+
If you have multiple versions of Python installed, such as a version you installed a while ago, you'll need to use the complete path to Python in order to run it. Usually it'll look something like this:
23+
24+
```
25+
C:\\Users\\yourname\\AppData\\Local\\Programs\\Python\\Python39-32\\python.exe
26+
```
27+
28+
When you use an IDE, such as [Visual Studio Code](../how_to_install_ide), you can use the integrated terminal instead of `cmd.exe`.
29+
30+
## On Mac
31+
32+
To install Python, download the latest version of Python from https://www.python.org. At the time of writing, that was Python 3.10.4.
33+
34+
Once Python is installed, you can execute the program `Terminal.app`. This is a command-line interface to your computer. Here, just type the word `python3.9` and that will start the Python program.
35+
36+
At all points during the course, you can always type `python3.9 name_of_file.py` and that will execute the code of a file called `name_of_file.py`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: How to install an IDE
3+
description: What IDE should you use? How do you install it? Let me show you in this quick guide.
4+
---
5+
6+
# How to install an IDE
7+
8+
An IDE is an Integrated Development Environment. If you've got experience coding, I'm sure you've used an IDE at some point or another.
9+
10+
IDEs are text editors that let you modify your code. However, as the name says, they do a bit more than just that.
11+
12+
Often we can use IDEs to run our code, connect to databases, use a debugger, or a whole host of other things!
13+
14+
Throughout this course I use Visual Studio Code. It's a very powerful IDE that you can get for free at https://code.visualstudio.com/. If you get VS Code, I've got a blog post on how to set it up for Python development: https://blog.tecladocode.com/how-to-set-up-visual-studio-code-for-python-development/
15+
16+
## Opening Projects
17+
18+
Whenever you work using an IDE, you should open separate projects in separate windows:
19+
20+
- 👍 When you start a section of the course, make a folder for that section and open it with VSCode. Now VSCode treats that as a "project" folder.
21+
- 👎 Make a folder for the entire course and open it with VSCode. Inside it, make a folder for each section. VSCode will treat the top-level course folder as the "project", and your experience will be a bit more difficult.
22+
23+
I've noticed some students like opening their "projects" folder with the IDE, so that they can work on all their projects in one window. This is likely to cause problems due to how Python looks for code files to use and import (more on that when you get to the "Imports" section of the Python Refresher!).
24+
25+
So don't be afraid to have many different project folders, each one with their own virtual environment and dependencies. That's normal and will make it much easier to work with!

0 commit comments

Comments
 (0)