Skip to content

Commit 35f1b9f

Browse files
Merge pull request #80 from josemoracard/jose2-00-intro
exercises 00-intro to 04-runnig-flask
2 parents 7108da9 + 268d433 commit 35f1b9f

File tree

22 files changed

+139
-114
lines changed

22 files changed

+139
-114
lines changed

.learn/exercises/00-intro/README.es.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Bienvenido a Flask!
1+
# Welcome to Flask!
22

3-
En este tutorial vamos a construir una REST API que expone 3 endpoints
4-
internet:
3+
En este tutorial vamos a construir una REST API que expone 3 endpoints a Internet:
54

65
```txt
76
GET /todos
@@ -39,7 +38,24 @@ Añadirá un nuevo to-do a la lista. Recibirá el siguiente request body:
3938

4039
Y retornará la lista actualizada de los to-dos:
4140

41+
```javascript
42+
[
43+
{
44+
"done": true,
45+
"label": "Sample Todo 1"
46+
},
47+
{
48+
"done": true,
49+
"label": "Sample Todo 2"
50+
},
51+
{
52+
"done": true,
53+
"label": "Sample Todo 3"
54+
}
55+
]
56+
```
57+
4258
## DELETE /todos/<int:position>
4359

44-
Eliminará un to-do basándose en la posición dada al final de la url, y retorna la lista actualizada de to-dos.
60+
Eliminará un to-do basándose en la posición dada al final de la URL y retorna la lista actualizada de to-dos.
4561

.learn/exercises/00-intro/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Welcome to Flask!
22

3-
In this tutorial we are going to be building a REST API that exposes 3 endpoints to the internet:
3+
In this tutorial, we are going to be building a REST API that exposes 3 endpoints to the Internet:
44

55
```txt
66
GET /todos
77
POST /todos
88
DELETE /todos/<int:position>
99
```
1010

11-
## **GET /todos**
11+
## GET /todos
1212

1313
It will return the list of all todos in a JSON format like this:
1414

@@ -25,7 +25,7 @@ It will return the list of all todos in a JSON format like this:
2525
]
2626
```
2727

28-
## **POST /todos**
28+
## POST /todos
2929

3030
The POST method is going to add a new todo to the list by sending the following request body:
3131

@@ -36,7 +36,7 @@ The POST method is going to add a new todo to the list by sending the following
3636
}
3737
```
3838

39-
And then, it returns the updated list of todos:
39+
And then it returns the updated list of todos:
4040

4141
```javascript
4242
[
@@ -55,6 +55,6 @@ And then, it returns the updated list of todos:
5555
]
5656
```
5757

58-
## **DELETE /todos/<int:position>**
58+
## DELETE /todos/<int:position>
5959

60-
The DELETE method is going to remove one todo based on a given position at the end of the url, and return the updated list of todos.
60+
The DELETE method is going to remove one todo based on a given position at the end of the URL and return the updated list of todos.
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
# Hello World with Flask
1+
# `01` Hello World with Flask
22

3-
En este tutorial construiremos una REST API utilizando el lenguaje de programación Python y la librería de Flask [Flask library](https://flask.palletsprojects.com/en/1.1.x/) (ideal para crear API's).
3+
En este tutorial construiremos una REST API utilizando el lenguaje de programación Python y la librería de [Flask](https://flask.palletsprojects.com/) (ideal para crear APIs).
44

55
¡Pero vamos a hacerlo correctamente! Siguiendo todas las buenas prácticas; Es por ello que debemos instalar y aprender un par de cosas antes.
66

7-
## 📦 Requerimientos
7+
## 📦 Requerimientos:
88

99
1. Python 3+
1010

11-
2. **Pipenv**: Utilizaremos [Pipenv package manager](https://pipenv-fork.readthedocs.io/en/latest/) en estos ejercicios, por favor instala [Pipenv en tu computador](https://github.com/pypa/pipenv#installation) si es que aún no lo has hecho.
11+
2. **Pipenv**: Utilizaremos [Pipenv package manager](https://pipenv-fork.readthedocs.io/en/latest/) en estos ejercicios, por favor instala [Pipenv en tu computador](https://github.com/pypa/pipenv#installation) si es que aún no lo has hecho.
1212

13-
Si estás en Gitpod, no tienes que instalar nada, Pipenv y Python 3 ya están instalados.
13+
Si estás en Codespaces o Gitpod, no tienes que instalar nada, Pipenv y Python 3 ya están instalados.
1414

1515
## 📝 Instrucciones:
1616

17-
1. Abre una nueva terminal (deja esta abierta).
17+
1. Abre una nueva terminal (y mantenla abierta).
1818

1919
2. Asegúrate de tener la versión 3 de Python:
2020

2121
```bash
2222
$ python --version
2323

24-
# otra alternativa es tipear:
24+
# Otra alternativa es:
2525

2626
$ python3 --version
2727
```
2828

29-
👉 Nota: Si no tienes la versión 3 de Python, instálala, [🔥 te recomendamos usar Pyenv](https://github.com/pyenv/pyenv) para instalar Python.
29+
> 👉 Nota: Si no tienes la versión 3 de Python, instálala, [🔥 te recomendamos usar Pyenv](https://github.com/pyenv/pyenv) para instalar Python.
3030
3131
3. Asegúrate de tener `pipenv` instalado:
3232

3333
En vez de usar Pip y virtual env, usaremos Pipenv: Una combinación de ambas tecnologías que harán tu vida mucho más fácil.
3434

35-
```txt
35+
```bash
3636
$ pipenv --version
3737
```
3838

39-
Prueba estos pasos y dale clic a `next →` para continuar.
39+
Termina con las instrucciones y dale clic a `next →` para continuar.
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
1-
# Hello World with Flask
1+
# `01` Hello World with Flask
22

3-
During this tutorial, we'll be building a REST API using the Python programming language and the [Flask library](https://flask.palletsprojects.com/en/1.1.x/) (ideal for creating APIs).
3+
During this tutorial, we'll be building a REST API using the Python programming language and the [Flask library](https://flask.palletsprojects.com/) (ideal for creating APIs).
44

55
But we are going to do it the right way! Following all the good practices, we have to install and learn some things first.
66

7-
## 📦 Requirements
7+
## 📦 Requirements:
88

99
1. Python 3+
1010

11-
2. Pipenv: we are going to be using the [Pipenv package manager](https://pipenv-fork.readthedocs.io/en/latest/) during these exercises, please install [Pipenv in your computer](https://github.com/pypa/pipenv#installation) if you don't have it already.
11+
2. **Pipenv**: we are going to be using the [Pipenv package manager](https://pipenv-fork.readthedocs.io/en/latest/) during these exercises, please install [Pipenv in your computer](https://github.com/pypa/pipenv#installation) if you don't have it already.
1212

13-
If you are building this project using Gitpod, you don't have to install anything. Pipenv and Python 3 already come pre-installed.
13+
If you are building this project using Codespaces or Gitpod, you don't have to install anything. Pipenv and Python 3 already come pre-installed.
1414

1515
## 📝 Instructions:
1616

17-
1. Open a new terminal (leave this one open)
17+
1. Open a new terminal (and leave it open).
1818

19-
2. Make sure you have python version 3 by running the following commands:
19+
2. Make sure you have Python version 3 by running the following commands:
2020

2121
```bash
2222
$ python --version
2323

24-
# alternatively you can type
24+
# Alternatively you can type:
2525

2626
$ python3 --version
2727
```
2828

29+
> 👉 Note: if you don't have python version 3 you should go ahead and install it, we [🔥 strongy recommend using Pyenv](https://github.com/pyenv/pyenv) to install python.
2930
30-
👉 Note: if you don't have python version 3 you should go ahead and install it, we [🔥 strongy recommend using Pyenv](https://github.com/pyenv/pyenv) to install python.
31-
32-
3. Make sure you have pipenv installed:
31+
3. Make sure you have `pipenv` installed:
3332

3433
Instead of using Pip and virtual env separately, we are going to be using Pipenv: A combination of both technologies that will make your life much easier.
3534

3635
```bash
3736
$ pipenv --version
3837
```
3938

40-
Test your step and click `next →` continue.
39+
Finish the instructions and click `next →` to continue.

.learn/exercises/02-pipenv-installation/README.es.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Es posible tener varios proyectos con Python con diferentes versiones de Python, por esta razón debes especificar que versión de Python quieres usar en cada proyecto durante su configuración.
44

5-
En este caso, no importa que versión de Python usemos mientras sea mayor a 3.0.
5+
En este caso, no importa que versión de Python usemos mientras sea mayor a la `3.0`.
66

7-
Cada proyecto de python debe estar envuelto en un "ambiente virtual" para asegurarse de que cada uno de ellos tenga su propia versión de Python, módulos y librerías, nada se instala globalmente en tu computador, sólo se instala dentro del entorno en el que se encuentra en la carpeta `.venv`.
7+
Cada proyecto de Python debe estar envuelto en un "ambiente virtual" para asegurarse de que cada uno de ellos tenga su propia versión de Python, módulos y librerías, nada se instala globalmente en tu computador, solo se instala dentro del entorno en el que se encuentra en la carpeta `.venv`.
88

99
## 📝 Instrucciones:
1010

@@ -14,8 +14,8 @@ Cada proyecto de python debe estar envuelto en un "ambiente virtual" para asegur
1414
$ pipenv install --python 3
1515
```
1616

17-
Deberías ver un **PipFile** en la raíz de tu proyecto y dentro debería tener **[requires]** en la versión de Python 3+ similar a este (pero quizás con una diferente versión de Python 3).
17+
Deberías ver un **PipFile** en la raíz de tu proyecto y dentro debería tener **[requires]** en la versión de Python 3+ similar a este (pero quizás con una diferente versión de Python 3).
1818

1919
![Pipfile preview](../../assets/pipfile.png?raw=true)
2020

21-
Prueba este paso y haz clic en `next →` para continuar.
21+
Sigue los pasos y haz clic en `next →` para continuar.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# `02` Initialize Pipenv
22

3-
It is possible to have several python projects with different versions of python, that's why you need to specify which python version you want to use for every project during setup.
3+
It is possible to have several Python projects with different versions of Python, that's why you need to specify which Python version you want to use for every project during setup.
44

5-
In this case, we don't care which version of python we use as long as it's more than 3.0.
5+
In this case, we don't care which version of Python we use as long as it's more than `3.0`.
66

7-
Every python project should be wrapped in a "virtual environment" to ensure that each of them have their own Python version, modules and libraries. Make sure nothing gets installed globally in your computer, only install inside the specified environment under the `.venv` folder.
7+
Every Python project should be wrapped in a "virtual environment" to ensure that each of them have their own Python version, modules and libraries. Make sure nothing gets installed globally in your computer, only install inside the specified environment under the `.venv` folder.
88

99
## 📝 Instructions:
1010

11-
1. Run the following command to create a new virtual environment with python 3 on it:
11+
1. Run the following command to create a new virtual environment with Python 3 on it:
1212

1313
```bash
1414
$ pipenv install --python 3
1515
```
1616

17-
You should see a **PipFile** on the root of your project and it should have a **[requires]** inside of it for python version 3+: similar to this one (but maybe with a different python 3 version).
17+
You should see a **PipFile** on the root of your project and it should have a **[requires]** inside of it for Python version 3+: similar to this one (but maybe with a different Python 3 version).
1818

1919
![Pipfile preview](../../assets/pipfile.png?raw=true)
2020

21-
Test your step and click `next →` continue.
21+
Follow the steps and click `next →` to continue.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `02.1` Install Flask
22

3-
Ahora tenemos que instalar la dependencia de nuestro primer paquete para este proyecto: [Flask](https://flask.palletsprojects.com/en/1.1.x/).
3+
Ahora tenemos que instalar la dependencia de nuestro primer paquete para este proyecto: [Flask](https://flask.palletsprojects.com/).
44

55
## 📝 Instrucciones:
66

@@ -10,8 +10,8 @@ Ahora tenemos que instalar la dependencia de nuestro primer paquete para este pr
1010
$ pipenv install flask
1111
```
1212

13-
## Resultado esperado:
13+
## 💻 Resultado esperado:
1414

15-
![Expected console ouput](../../assets/install-flask.png?raw=true)
15+
![Resultado de consola esperado](../../assets/install-flask.png?raw=true)
1616

17-
Prueba estos pasos y dale clic a `next →` para continuar.
17+
Sigue los pasos y haz clic en `next →` para continuar.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# `02.1` Install Flask
22

3-
Now we have to install our first package dependency for this project: [Flask](https://flask.palletsprojects.com/en/1.1.x/).
3+
Now we have to install our first package dependency for this project: [Flask](https://flask.palletsprojects.com/).
44

5-
## 📝Instructions:
5+
## 📝 Instructions:
66

7-
1. Run the following command on your terminal to install the flask package:
7+
1. Run the following command on your terminal to install the Flask package:
88

99
```bash
1010
$ pipenv install flask
1111
```
1212

13-
## Expected output:
13+
## 💻 Expected output:
1414

1515
![Expected console ouput](../../assets/install-flask.png?raw=true)
1616

17-
Test your step and click `next →` continue.
17+
Follow the steps and click `next →` to continue.

.learn/exercises/02.1-flask-installation/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
def test_pipfile_exists():
55
assert os.path.isfile("Pipfile")
66

7-
@pytest.mark.it("Flask must exist on the pipfile dependency [packages]")
7+
@pytest.mark.it("Flask must exist on the Pipfile dependency [packages]")
88
def test_pipfile_contains_flask():
99
with open("Pipfile", "r") as f:
1010
toml_content = f.read()
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `03` First Flask App
22

3-
Flask es una app que se comporta como un servidor web, es decir que expone (publica) un grupo de URLs en internet (como una api o un sitio web).
3+
Flask es una app que se comporta como un servidor web, es decir, que expone (publica) un grupo de URLs en internet (como una API o un sitio web).
44

55
Por ejemplo, puedes usar Flask con un dominio y exponer las siguientes URLs en internet:
66

@@ -10,21 +10,20 @@ myporfolio.com/about-me
1010
myporfolio.com/contact-me
1111
```
1212

13-
Esas 3 URLs expuestas por Flask se convertirán en tu postafolio personal de sitios webs.
13+
Esas 3 URLs expuestas por Flask se convertirán en tu portafolio personal de sitios webs.
1414

1515
Para crear nuestro primer servidor debemos añadir las siguientes dos líneas en cualquier archivo de Python:
1616

17-
1817
```python
1918
from flask import Flask
2019
app = Flask(__name__)
2120
```
21+
2222
## 📝 Instrucciones:
2323

2424
1. En la raíz del proyecto crea una carpeta llamada `src`.
2525

26-
2. Dentro de ella, crea un archivo `src/app.py`.
26+
2. Dentro de ella, crea un archivo `app.py`.
2727

28-
3. Añade el código necesario para crear una nueva app Flask especificada en las intrucciones anteriores.
28+
3. Añade el código necesario para crear una nueva app Flask especificada en las instrucciones anteriores.
2929

30-

0 commit comments

Comments
 (0)