diff --git a/01-introduction/es/11-introduction_to_bottle_web_framework-lecture.srt b/01-introduction/es/11-introduction_to_bottle_web_framework-lecture.srt index f5996d2..2d9cec5 100644 --- a/01-introduction/es/11-introduction_to_bottle_web_framework-lecture.srt +++ b/01-introduction/es/11-introduction_to_bottle_web_framework-lecture.srt @@ -3,473 +3,466 @@ 2 00:00:00,100 --> 00:00:01,860 -In this class our -project is going +En este curso nuestro +proyecto va a ser 3 00:00:01,860 --> 00:00:05,574 -to be to build a blog -using MongoDB and Python. +construir un blog usando +MongoDB y Python. 4 00:00:05,574 --> 00:00:07,240 -And to do that we're -going to need a web +Para hacer eso vamos +a necesitar un framework 5 00:00:07,240 --> 00:00:09,710 -framework because this is -going to be a web application. +web, ya que vamos a hacer +una aplicación web. 6 00:00:09,710 --> 00:00:12,500 -And the one we're going to use -in the class is called Bottle. +El framework que vamos a usar +durante el curso se llama Bottle. 7 00:00:12,500 --> 00:00:16,820 -Bottle is a very simple web -framework that is minimalistic, +Bottle es un framework web +minimalista muy simple, 8 00:00:16,820 --> 00:00:20,210 -it has basic templates, and -lets you create web pages. +tiene plantillas básicas +y permite crear páginas web. 9 00:00:20,210 --> 00:00:22,750 -It's probably not something -you'd use for a production +Probablemente no sea algo que +usarías para un proyecto 10 00:00:22,750 --> 00:00:24,116 -project, but you could. +en producción, pero podrías. 11 00:00:24,116 --> 00:00:25,490 -But it's very good -for this class +En cualquier caso está +muy bien para este curso 12 00:00:25,490 --> 00:00:28,650 -because it sort of strips out -all the complexity of a lot +porque en cierto modo elimina +toda la complejidad de 13 00:00:28,650 --> 00:00:30,970 -of the modern web programming. +la programación web moderna. 14 00:00:30,970 --> 00:00:33,450 -So let's go find and install it. +Vamos a localizarlo y a instalarlo. 15 00:00:33,450 --> 00:00:35,097 -It's a Python module. +Es un módulo de Python. 16 00:00:35,097 --> 00:00:36,805 -So what I'm going to -do here is I'm going +Lo que voy a +hacer aquí es ir 17 00:00:36,805 --> 00:00:38,760 -to go to Google as I always do. +a Google, como siempre. 18 00:00:38,760 --> 00:00:41,110 -I'm a loyal Google user. +Soy un fiel usuario de Google. 19 00:00:41,110 --> 00:00:46,470 -And I'm going to say -Bottle Python framework. +Y voy a poner +"bottle python framework". 20 00:00:46,470 --> 00:00:49,610 -And it looks like -it's a Bottle.py.org. +Y parece que existe +un "bottlepy.org". 21 00:00:49,610 --> 00:00:51,730 -And so I click on -it, and I notice +Hago click en el +enlace y veo que 22 00:00:51,730 --> 00:00:54,320 -this is the preview release, -and I want the stable release. +existe una versión "preview", +pero quiero la versión estable. 23 00:00:54,320 --> 00:00:55,950 -So I click there. +Así que hago click ahí. 24 00:00:55,950 --> 00:00:58,980 -And now it gives me some basic -information about this module. +Y ahora me da cierta información +básica sobre este módulo. 25 00:00:58,980 --> 00:01:01,641 -And you can see they actually -have an example Hello World +Y puedes ver que tienen un +programa "Hello World" 26 00:01:01,641 --> 00:01:02,140 -program. +de ejemplo. 27 00:01:02,140 --> 00:01:03,900 -And we're going to -run that program. +Vamos a ejecutar +ese programa. 28 00:01:03,900 --> 00:01:05,080 -It's a very short program. +Es un programa muy corto. 29 00:01:05,080 --> 00:01:06,380 -I'm going to take you -through it, line by line, +Voy a guiarte por el +programa línea a línea, 30 00:01:06,380 --> 00:01:07,660 -and show you what it does. +y te enseñaré qué hace. 31 00:01:07,660 --> 00:01:10,010 -But right now we want to -download it and install it. +Pero ahora queremos +descargarlo e instalarlo. 32 00:01:10,010 --> 00:01:12,810 -Now they suggest that we get -it from the PyPi repository, +Ahora nos sugieren que lo +obtengamos del repositorio PyPI, 33 00:01:12,810 --> 00:01:14,830 -and they suggest that -we use easy_install. +y que usemos easy_install. 34 00:01:14,830 --> 00:01:16,140 -I prefer to use PIP. +Yo prefiero usar pip. 35 00:01:16,140 --> 00:01:18,860 -We have PIP installed in -both the MAC and the Windows +Hemos instalado pip tanto +en Mac como en Windows, 36 00:01:18,860 --> 00:01:21,520 -PC that we showed in -the earlier lesson. +como vimos en las +lecciones anteriores. 37 00:01:21,520 --> 00:01:23,930 -So let's go ahead and -use PIP to do this. +Así que seguiremos +adelante y usaremos pip. 38 00:01:23,930 --> 00:01:27,090 -So I'm going get -a Command window. +Voy a abrir una +ventana de comandos. 39 00:01:27,090 --> 00:01:30,940 -I'm going to become root, -which I need to do on this Mac. +Cambio al usuario "root", +es necesario hacerlo en Mac, 40 00:01:30,940 --> 00:01:34,250 -But I shouldn't need to do it on -the Windows box, I don't think. +pero no debería necesitar hacerlo +en una máquina Windows, creo. 41 00:01:34,250 --> 00:01:36,780 -So pip install bottle. +"pip install bottle". 42 00:01:36,780 --> 00:01:37,490 -All right. +Bien. 43 00:01:37,490 --> 00:01:39,270 -So that installed -the 12.8 version, +Se instaló la +versión 0.12.8, 44 00:01:39,270 --> 00:01:41,900 -which is good news because -we know that the version +lo cual es una buena noticia +porque sabemos que la versión 45 00:01:41,900 --> 00:01:44,390 -number 13 was unstable. +0.13 es inestable, 46 00:01:44,390 --> 00:01:45,940 -And so we don't want that one. +y por tanto no queremos usarla. 47 00:01:45,940 --> 00:01:47,320 -Let's see if that's true. +Veamos si es cierto. 48 00:01:47,320 --> 00:01:51,340 -It said the dot 12 was -stable, and this is dot 12. +Decía que la versión 0.12 era +estable, y ésta es la 0.12. 49 00:01:51,340 --> 00:01:52,020 -So that's good. +Así que está bien. 50 00:01:52,020 --> 00:01:53,630 -That's the stable version. +Es la versión estable. 51 00:01:53,630 --> 00:01:56,270 -And now we need -that little program. +Y ahora necesitamos +ese programita. 52 00:01:56,270 --> 00:01:58,482 -So to do that, the -easiest thing to do +Para hacer eso, lo más +sencillo es simplemente 53 00:01:58,482 --> 00:01:59,940 -is just to copy it -with your mouse. +copiarlo con el ratón. 54 00:01:59,940 --> 00:02:01,230 -And I've already done that. +Y ya he hecho eso. 55 00:02:01,230 --> 00:02:03,299 -You can use whatever -editor you want. +Puedes usar el editor +que prefieras. 56 00:02:03,299 --> 00:02:04,840 -I'm going to use -Emacs because that's +Yo voy a usar +Emacs porque me 57 00:02:04,840 --> 00:02:06,652 -what I'm most familiar -with, and I'm just +resulta muy familar, +y ahora voy a 58 00:02:06,652 --> 00:02:08,860 -going to take you through -this program, line by line, +guiarte por este programa, +línea a línea, 59 00:02:08,860 --> 00:02:10,360 -and show you what it does. +mostrándote qué hace. 60 00:02:10,360 --> 00:02:13,600 -So from Bottle it imports a few -different methods-- route, run, +Importa unos cuantos métodos +diferentes de Bottle: "route", "run" 61 00:02:13,600 --> 00:02:14,550 -and template. +y "template". 62 00:02:14,550 --> 00:02:17,770 -It uses these decorators, -and these decorators +Usa estos decoradores, que 63 00:02:17,770 --> 00:02:20,020 -are used to set up -URLs that the web +se utilizan para configurar +las URLs que atenderá 64 00:02:20,020 --> 00:02:21,520 -server is going to listen on. +el servidor web. 65 00:02:21,520 --> 00:02:23,190 -So here it's saying -that it wants +Entonces, aquí está +diciendo que quiere 66 00:02:23,190 --> 00:02:27,030 -to listen on slash -hello slash name, +capturar "/hello/", 67 00:02:27,030 --> 00:02:29,360 -that that's a URL this -program will handle, +es una URL que +manejará este programa, 68 00:02:29,360 --> 00:02:30,580 -where name is a variable. +donde "name" es una variable. 69 00:02:30,580 --> 00:02:33,960 -So it could be hello slash -Andrew or hello slash Bob. +Podría ser "/hello/Andrew" +o "/hello/Bob", 70 00:02:33,960 --> 00:02:37,850 -And that it will return -this template, which +y devolverá +esta plantilla, que 71 00:02:37,850 --> 00:02:38,600 -is right in place. +está aquí mismo. 72 00:02:38,600 --> 00:02:40,725 -And you can also get it -from a templates directory, +También puedes recuperarla +de un directorio de plantillas, 73 00:02:40,725 --> 00:02:42,610 -but in this case it's -inline to template. +pero en este caso es +una plantilla en línea. 74 00:02:42,610 --> 00:02:45,870 -It says return hello name. +Dice: devuelve "Hello {{name}}!". 75 00:02:45,870 --> 00:02:47,420 -It's bolded with an -exclamation mark, +Está en negrita y con un +signo de exclamación, 76 00:02:47,420 --> 00:02:49,980 -and that's it, where -name equals name. +y eso es todo, donde +"name = name". 77 00:02:49,980 --> 00:02:51,590 -And the last thing -is just telling +Y por último, le +está diciendo 78 00:02:51,590 --> 00:02:53,650 -it to run the web -server and listen on it. +que ejecute el servidor +web y que escuche: 79 00:02:53,650 --> 00:02:57,350 -And so it says run host -equals local host port 8080. +"run(host='localhost', port=8080)". 80 00:02:57,350 --> 00:02:59,970 -So let's run that -and see what happens. +Ejecutemos el programa y +veamos qué pasa. 81 00:02:59,970 --> 00:03:02,310 -So we're going to invoke -the Python interpreter +Vamos a invocar +el intérprete de Python 82 00:03:02,310 --> 00:03:03,670 -on hello Bottle. +sobre "hello_bottle.py". 83 00:03:03,670 --> 00:03:05,670 -This is not using -MongoDB at all. +Esto no está usando +MongoDB para nada. 84 00:03:05,670 --> 00:03:06,170 -All right. +Bien. 85 00:03:06,170 --> 00:03:07,800 -It's listening on port 8080. +Está escuchando en el puerto 8080. 86 00:03:07,800 --> 00:03:09,900 -Let's go back to -the web browser. +Volvamos al +navegador web. 87 00:03:09,900 --> 00:03:14,444 -Go to port 8080, the URL -hello, and then append +Ve al puerto 8080, escribe la URL +"/hello/", y a continuación añade 88 00:03:14,444 --> 00:03:16,485 -Andrew on the end and see -if it says hello to me. +"Andrew" al final, veamos +si me saluda. 89 00:03:16,485 --> 00:03:17,850 -It says hello Andrew. +Dice: "Hello Andrew!". 90 00:03:17,850 --> 00:03:21,550 -And we could also have -it say, hello Eliot . +Y podríamos haber hecho +que dijera "Hello Eliot!". 91 00:03:21,550 --> 00:03:22,430 -Hello Eliot. +"Hello Eliot!". 92 00:03:22,430 --> 00:03:26,420 -And it can say hello -Richard, if we want. +Y si queremos, puede +decir "Hello Richard!". 93 00:03:26,420 --> 00:03:27,240 -That's it. +Eso es. 94 00:03:27,240 --> 00:03:29,448 -And then you can see every -time I hit the web server, +Puedes ver que cada vez +que pongo algo en el navegador web 95 00:03:29,448 --> 00:03:31,510 -it prints out the URL -that got hit, which +imprime lo que puse en la URL, 96 00:03:31,510 --> 00:03:33,984 -is Andrew, Eliot, and Richard. +"Andrew", "Eliot", and "Richard". 97 00:03:33,984 --> 00:03:35,650 -So that's how you -install Bottle and how +Así es como se instala y ejecuta 98 00:03:35,650 --> 00:03:36,940 -you get it running on a Mac. +Bottle en un Mac. 99 00:03:36,940 --> 00:03:38,600 -And on Windows -it's very similar. +Y en Windows +es muy similar. 100 00:03:38,600 --> 00:03:41,205 -As long as you've got PIP -installed and Python installed +Siempre que tengas +instalado pip y Python 101 00:03:41,205 --> 00:03:42,580 -and your scripts -are correct, you +y tus scripts +sean correctos, 102 00:03:42,580 --> 00:03:45,670 -should be able to do this -in pretty much the same way. +deberías ser capaz de hacer +esto de forma muy similar.