Skip to content

Commit

Permalink
Merge pull request #64 from tecladocode/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jslvtr committed Sep 23, 2022
2 parents 3380640 + 73069fd commit d4eb6e9
Show file tree
Hide file tree
Showing 1,072 changed files with 57,012 additions and 2,829 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 88
exclude = .git,__pycache__
max-complexity = 10
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ __pycache__/
*.db
.DS_Store
venv/
.venv/
.venv/
docs/docs/.nota/config.ini
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Flask-Smorest Docker"]
path = project/using-flask-smorest-docker
url = https://github.com/tecladocode/rest-api-smorest-docker
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.0
17 changes: 17 additions & 0 deletions .templates/lecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: The lecture title goes here
description: A brief description of the lecture goes here.
---

- [ ] Set metadata above
- [ ] Start writing!
- [ ] Create `start` folder
- [ ] Create `end` folder
- [ ] Write TL;DR
- [ ] Create per-file diff between `end` and `start` (use "Compare Folders")



# Lecture Title


7 changes: 7 additions & 0 deletions .templates/section.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: "Section name here"
---

# Section name here

Description of the section goes here.
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# How to contribute to this course

## E-book contributions

### How to run the e-book

Clone the repo and navigate to the `docs` folder.

There, run:

```
npm install
```

Then you can run the e-book with:

```
npm run start
```

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.

If you are making larger changes, please create a Discussion first and let's talk about it!

### Making changes to projects

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.

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).
50 changes: 19 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,54 +36,42 @@ If you do this for the entire course, I guarantee you will learn how to make RES

## Section 2: A Full Python Refresher

The code is in files numbered between 1 and 11, covering concepts ranging from beginner to advanced.

1. Variables
2. Methods
3. Lists, tuples, and sets
4. If statements
5. List comprehension
6. Dictionaries
7. Classes and objects
8. Static and class methods
9. Args and Kwargs
10. Passing functions as arguments
11. Decorators
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!

## Section 3: Your first REST API

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

## Section 4: Flask-RESTful
## Section 4: Docker

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

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

## Section 5: Working with SQL

The code in this section extends the last section by adding persistent storage of Items to a SQLite database.
We introduce the Flask-Smorest extension, a library that greatly simplifies writing REST APIs using Flask. It also provides things like automated documentation generation.

## Section 6: Flask-SQLAlchemy

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.
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.

## Section 7: Many-to-many relationships

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

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.
## Section 8: Authentication with Flask-JWT-Extended

## Section 8: Deploying Flask Apps to Heroku
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.

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

## Section 9: Deploying Flask Apps to our own servers
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.

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.
Flask-Migrate and the Alembic libraries simplify this job by creating migration scripts.

## Section 10: Security in your REST APIs
## Section 10: Git Crash Course

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

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

Learn about token freshness and how to implement refresh tokens using Flask-JWT-Extended.
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.
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ npm install
```

### Local Development

```
$ npm run start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true npm run deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> npm run deploy
```

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.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Project overview
1 change: 1 addition & 0 deletions docs/docs-upcoming/11_celery_background_tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Flask-Smorest for more efficient development
4 changes: 4 additions & 0 deletions docs/docs-upcoming/11_celery_background_tasks/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Use Celery for Background Tasks",
"position": 12
}
8 changes: 8 additions & 0 deletions docs/docs/01_course_intro/01_curriculum_overview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Curriculum overview
description: A brief description of the lecture goes here.
---

# Curriculum overview

The curriculum overview goes here.
36 changes: 36 additions & 0 deletions docs/docs/01_course_intro/02_how_to_install_python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: How to install Python
description: A brief description of the lecture goes here.
---

# How to install Python on your computer

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!

## On Windows

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.

:::caution Add to PATH
As you go through the installer, make sure to check "Add Python to PATH".
:::

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.

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`

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:

```
C:\\Users\\yourname\\AppData\\Local\\Programs\\Python\\Python39-32\\python.exe
```

When you use an IDE, such as [Visual Studio Code](../how_to_install_ide), you can use the integrated terminal instead of `cmd.exe`.

## On Mac

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.

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.

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`.
25 changes: 25 additions & 0 deletions docs/docs/01_course_intro/03_how_to_install_ide/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: How to install an IDE
description: What IDE should you use? How do you install it? Let me show you in this quick guide.
---

# How to install an IDE

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.

IDEs are text editors that let you modify your code. However, as the name says, they do a bit more than just that.

Often we can use IDEs to run our code, connect to databases, use a debugger, or a whole host of other things!

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/

## Opening Projects

Whenever you work using an IDE, you should open separate projects in separate windows:

- 👍 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.
- 👎 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.

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!).

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!
Loading

0 comments on commit d4eb6e9

Please sign in to comment.