<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6232554193087666894</id><updated>2024-12-02T09:03:24.518-08:00</updated><category term="django"/><category term="python"/><category term="software libre"/><category term="decreto 3.390"/><category term="abierto"/><category term="django-1.5"/><category term="empresa"/><category term="javascript"/><category term="linux"/><category term="web"/><category term="Deploy Django"/><category term="Hidrobolivar"/><category term="Hidrobolívar"/><category term="Ubuntu"/><category term="ajax"/><category term="django-1.4"/><category term="jquery"/><category term="programación"/><category term="1.6"/><category term="Canaima GNU/Linux"/><category term="Centos"/><category term="Django 1.7"/><category term="ERP"/><category term="ForeignKey"/><category term="Gunicorn"/><category term="JSON"/><category term="Jelly Bean"/><category term="Nginx"/><category term="PostgreSQL"/><category term="Python 3"/><category term="Supervisor"/><category term="android"/><category term="autenticación"/><category term="auth"/><category term="authentication"/><category term="autocomplete"/><category term="class based views"/><category term="flash"/><category term="galaxy"/><category term="jpegcam"/><category term="legal"/><category term="nexus"/><category term="pirata"/><category term="planificación"/><category term="propietario"/><category term="reCAPTCHA"/><category term="register"/><category term="samsung"/><category term="user"/><category term="webcam"/><title type='text'>La Empresa con Software Abierto</title><subtitle type='html'>Blog realizado para comentar que sí es posible la Empresa con Software Libre, sin necesidad de tener matrimonios forzados con software que no se adaptan a los cambios que afrontamos cada día.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-4834495304645373514</id><published>2014-11-01T07:07:00.000-07:00</published><updated>2014-11-02T09:10:25.964-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="Django 1.7"/><category scheme="http://www.blogger.com/atom/ns#" term="programación"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="Python 3"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Probando Django 1.7 con Python 3</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Django desde la versión 1.5 es compatible con Python 3, muchos programadores han estado probando y portando sus aplicaciones de Django a esta nueva versión por las ventajas que ofrece.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
¡Usa la ultima versión estable!&lt;/h3&gt;
La última versión estable es la 3.4.2, al momento de escribir este articulo, la versión de Ubuntu 14.04 viene con la 3.4.0, es la que usare para este tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Entorno Virtual con Python 3&lt;/h3&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;$ pyvenv-3.4 --without-pip py3&amp;nbsp; # py3 es el nombre del virtualenv&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
&amp;nbsp;Activar el entorno vitual:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;$ cd py3&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;$ source bin/activate&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;(py3) $&amp;nbsp;&lt;/i&gt;
&lt;/blockquote&gt;
Verifica que el entorno virtual esta en Python 3:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;en&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;(py3) $ python --version&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;en&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;&amp;nbsp;Python 3.4.0&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
Instalar pip:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;(py3) $ curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;h3&gt;
Django&lt;/h3&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;(py3) $ pip install django&lt;/i&gt;&lt;/blockquote&gt;
Crear un proyecto:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;(py3) $&amp;nbsp; django-admin startproject demo&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;(py3) $&amp;nbsp; cd demo&lt;/i&gt;
&lt;/blockquote&gt;
Crear la base de datos en Django 1.7&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;(py3) $ python manage.py migrate&lt;/i&gt;&lt;/blockquote&gt;
&lt;h3&gt;
Servidor de Desarrollo&lt;/h3&gt;
Probamos nuestro servidor de desarrollo a ver si todo va bien hasta ahora&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;&lt;i&gt;(py3) $ python manage.py runserver&lt;/i&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Performing system checks...&lt;br /&gt;
&lt;br /&gt;
System check identified no issues (0 silenced).&lt;br /&gt;
November 01, 2014 - 03:00:12&lt;br /&gt;
Django version 1.7.1, using settings &#39;demo.settings&#39;&lt;br /&gt;
Starting development server at http://127.0.0.1:8000/&lt;br /&gt;
Quit the server with CONTROL-C.&lt;/blockquote&gt;
Probamos en la dirección http://127.0.0.1:8000&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Creado una Aplicación&lt;/h3&gt;
Vamos a crear una aplicación:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&amp;nbsp;(py3) $ python manage.py startapp main&lt;/i&gt;&lt;/blockquote&gt;
Creamos el modelo de la Aplicación en main/models.py&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;from django.db import models&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;class Persona(models.Model):&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; nombre = models.CharField(max_length=100)&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; apellido = models.CharField(max_length=100)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; def __str__(self):&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return self.nombre&lt;/i&gt;&lt;/blockquote&gt;
Como podrán ver se usa el método &lt;b&gt;__str__&lt;/b&gt; en vez de &lt;b&gt;__unicode__&lt;/b&gt;, ya que es uno de los cambios en Python 3&lt;br /&gt;
&lt;br /&gt;
Agregamos &lt;i&gt;main&lt;/i&gt; en demo/settings.py en INSTALLED_APPS&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;INSTALLED_APPS = (&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &#39;django.contrib.admin&#39;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &#39;django.contrib.auth&#39;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &#39;django.contrib.contenttypes&#39;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &#39;django.contrib.sessions&#39;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &#39;django.contrib.messages&#39;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &#39;django.contrib.staticfiles&#39;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &#39;main&#39;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;) &lt;/i&gt;&lt;/blockquote&gt;
Ahora ejecutamos:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;(py3) $ python manage.py makemigrations main&lt;/i&gt;&lt;/blockquote&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Mediante la ejecución de&lt;/span&gt; &lt;i&gt;&lt;span class=&quot;hps&quot;&gt;makemigrations&lt;/span&gt;&lt;/i&gt;, &lt;span class=&quot;hps&quot;&gt;le decimos a&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;Django&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;que&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;se han hecho&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;algunos cambios&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;en el&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;modelo&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;(en este caso&lt;/span&gt;, &lt;span class=&quot;hps&quot;&gt;son&lt;/span&gt;&lt;span class=&quot;hps&quot;&gt; nuevos)&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;y que&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;desea&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;que los cambios se&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;guarden como&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;una migración.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Ahora&lt;/span&gt;, ejecute &lt;i&gt;&lt;span class=&quot;hps&quot;&gt;migrate&lt;/span&gt;&lt;/i&gt; &lt;span class=&quot;hps&quot;&gt;de nuevo para crear&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;las tablas&lt;/span&gt; del &lt;span class=&quot;hps&quot;&gt;modelo&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;en&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;la base de datos&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;(py3) $ python manage.py migrate&lt;/i&gt;&lt;/blockquote&gt;
&lt;h3&gt;
Creando el usuario Administrador&lt;/h3&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Para&lt;/span&gt;&lt;span class=&quot;hps&quot;&gt;&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;crear&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;un usuario que puede&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;iniciar sesión en el&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;sitio de administración&lt;/span&gt;. &lt;span class=&quot;hps&quot;&gt;Ejecute el&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;siguiente comando&lt;/span&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;i&gt;(py3) $ python manage.py createsuperuser&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;Como podrás ver, hasta aquí hemos creado una aplicación básica de Django usando Python 3, te recomiendo que revises la &lt;a href=&quot;http://adf.ly/tdk7M&quot; target=&quot;_blank&quot;&gt;documentación&lt;/a&gt; para la creación de sitios web con Django.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;¡Consideraciones Importantes!&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;Chequea siempre si los paquetes que vas a utilizar desde &lt;a href=&quot;http://adf.ly/tfu3f&quot; target=&quot;_blank&quot;&gt;PyPi&lt;/a&gt; son compatibles con Python 3&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;En un proyecto&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;Django&lt;/span&gt;, compruebe en los &lt;span class=&quot;hps&quot;&gt;modelos, los métodos&amp;nbsp;&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;__str __&lt;/span&gt; &lt;span class=&quot;hps atn&quot;&gt;(&lt;/span&gt;)&lt;span class=&quot;hps&quot;&gt;&lt;/span&gt;. &lt;span class=&quot;hps&quot;&gt;Si&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;los tiene&lt;/span&gt;, es &lt;span class=&quot;hps&quot;&gt;un buen&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;indicador de&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;que es&lt;/span&gt; compatible con &lt;span class=&quot;hps&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;3.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;short_text&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Utilice&lt;/span&gt; &lt;a href=&quot;http://adf.ly/tfuAL&quot; target=&quot;_blank&quot;&gt;&lt;span class=&quot;hps&quot;&gt;2to3&lt;/span&gt;&lt;/a&gt; &lt;span class=&quot;hps&quot;&gt;para escanear&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;el código de&lt;/span&gt; &lt;span class=&quot;hps alt-edited&quot;&gt;problemas de compatibilidad.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;short_text&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps alt-edited&quot;&gt;Revisa el sitio donde va correr en producción tu aplicación, &lt;/span&gt;&lt;/span&gt;en el caso de Linux, la mayoría de las distribuciones ya 
tienen Python 3 instalado, y es accesible a los usuarios finales. En 
general, la eliminación de Python 2 por defecto, ha sido gradual. Sin 
embargo, hay algunos módulos clave que pueden requerir el uso de 
Python 2 en lugar de Python 3&lt;/li&gt;
&lt;li&gt;Ya existen cerca de 500 paquetes de Django compatibles con Python3, eso lo puedes revisar en la pagina de &lt;a href=&quot;http://adf.ly/tdj7i&quot; target=&quot;_blank&quot;&gt;Django Packages&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Aunque&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;la mayoría del código&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;está&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;escrito&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;para Python&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;2.x&lt;/span&gt;,&lt;span class=&quot;hps&quot;&gt; Python 3&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;es el presente y&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;futuro de este lenguaje de programación&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;P&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;ython&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;2.7.8&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;fue&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;lanzado en&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;Octubre de 2014.&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;La rama&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;2.x&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;no tendrá&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;más &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;lanzamientos&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;importantes&lt;/span&gt;&lt;span class=&quot;hps&quot;&gt;&lt;/span&gt;, &lt;span class=&quot;hps&quot;&gt;aunque&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;la&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;versión 2.7&lt;/span&gt; en&lt;span class=&quot;hps&quot;&gt; su vida útil&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;tendrá&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;un período prolongado de&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;correcciones &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;de &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;errores&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;huecos de &lt;/span&gt;&lt;span class=&quot;hps&quot;&gt;seguridad&lt;/span&gt;&lt;span class=&quot;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;3.x&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;continúa siendo&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;desarrollado&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;activamente&lt;/span&gt;. &lt;span class=&quot;hps&quot;&gt;El&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;lanzamiento más&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;reciente&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;de&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;3.4&lt;/span&gt;, fue el 6 de Octubre del 2014.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;span class=&quot;short_text&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Recursos&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;útiles&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
Los siguientes enlaces son recursos que pueden revisar a fin de tener mas información sobre Python 3 y como portar sus aplicaciones a esta versión del lenguaje.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://adf.ly/tdjGF&quot; target=&quot;_blank&quot;&gt;Python.org&lt;/a&gt; - Página Oficial de Python&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://adf.ly/tdjRg&quot; target=&quot;_blank&quot;&gt;getpython3.com&lt;/a&gt; - &lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Este&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;sitio tiene como objetivo&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;ser un recurso&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;para &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;para&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;desarrolladores de &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://adf.ly/tdjc5&quot; target=&quot;_blank&quot;&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;Python 3 Porting Guide&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;&lt;a href=&quot;http://adf.ly/tdjiH&quot; target=&quot;_blank&quot;&gt;My experiences with Django and Python 3&lt;/a&gt; - Blog de &lt;/span&gt;&lt;/span&gt;Daniel Greenfeld&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;&lt;a href=&quot;http://adf.ly/tdjr0&quot; target=&quot;_blank&quot;&gt;Pagina&lt;/a&gt; para revisar los módulos mas populares portados a Python 3&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;La Documentación de &lt;a href=&quot;http://adf.ly/tdjzU&quot; target=&quot;_blank&quot;&gt;Django&lt;/a&gt; sobre Python 3&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
Para concluir aclaro que este articulo es con fines didácticos y siempre depende de usted el buscar la mejor alternativa para su aplicación web con Django. Python 2 aún tiene soporte y lo va mantener por mucho tiempo, espero que con este artículo le ayude a crear su propia estrategia de desarrollo con Django.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/4834495304645373514/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2014/11/probando-django-17-con-python-3.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/4834495304645373514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/4834495304645373514'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2014/11/probando-django-17-con-python-3.html' title='Probando Django 1.7 con Python 3'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-524085542138271726</id><published>2014-06-22T11:26:00.000-07:00</published><updated>2014-07-24T18:21:25.858-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="1.6"/><category scheme="http://www.blogger.com/atom/ns#" term="autenticación"/><category scheme="http://www.blogger.com/atom/ns#" term="auth"/><category scheme="http://www.blogger.com/atom/ns#" term="authentication"/><category scheme="http://www.blogger.com/atom/ns#" term="class based views"/><category scheme="http://www.blogger.com/atom/ns#" term="Deploy Django"/><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="reCAPTCHA"/><category scheme="http://www.blogger.com/atom/ns#" term="register"/><category scheme="http://www.blogger.com/atom/ns#" term="user"/><title type='text'>Registro de Usuarios para un sitio web con Django 1.6 usando Class Based Views y reCAPTCHA</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
En esta nueva entrada veremos como registrar usuarios en un sitio web creado con Django 1.6 y utilizando las vistas basadas en clases (Class Based Views), es importante recordar que desde la versión 1.5 Django introduce soporte para un modelo de usuario configurable, donde el modelo básico sigue presente, solo que ahora podemos especificar nuestro propio modelo y el sistema de autenticación de Django lo usa perfectamente.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Hay un cambio de paradigma total en este aspecto, si eres un programador de versiones anteriores a la 1.5, donde completabas el modelo del usuario con perfiles, esto ha quedado oficialmente desaprobado en la versión 1.6 en favor de modelos de usuarios personalizados. Dichos modelos deben ser configurados en la creación inicial del proyecto. les invito a ver la &lt;a href=&quot;http://adf.ly/qYxN7&quot; target=&quot;_blank&quot;&gt;documentación&lt;/a&gt; para ampliar mas este tema.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
También se aprovecha al&amp;nbsp; máximo el uso de las vistas basadas en clases (&lt;a href=&quot;http://adf.ly/qYxRJ&quot; target=&quot;_blank&quot;&gt;CBV&lt;/a&gt;), yo voy asumir que quienes están siguiendo este tutorial debe tener los conocimientos básicos del uso de Django.&lt;br /&gt;
&lt;br /&gt;
También utilizaremos &lt;a href=&quot;http://adf.ly/qYxVp&quot; target=&quot;_blank&quot;&gt;ReCaptcha&lt;/a&gt; que nos &lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;ayudara a prevenir&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;el abuso&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;automatizado&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;del sitio&lt;/span&gt; web &lt;span class=&quot;hps&quot;&gt;(por ejemplo,&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;los comentarios no deseados&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;o registros&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;falsos&lt;/span&gt;) &lt;span class=&quot;hps&quot;&gt;usando un&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;CAPTCHA,&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;garantizamos que&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;sólo los seres humanos&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;realizan&lt;/span&gt; &lt;span class=&quot;hps&quot;&gt;estas acciones. Nos apoyaremos con una aplicación llamada &lt;a href=&quot;http://adf.ly/qYxa7&quot; target=&quot;_blank&quot;&gt;django-recaptcha&lt;/a&gt;, para facilitarnos esta tarea.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;&quot; id=&quot;result_box&quot; lang=&quot;es&quot; tabindex=&quot;-1&quot;&gt;&lt;span class=&quot;hps&quot;&gt;La aplicación de registro le permitirá a un usuario ingresar sus datos y correo electrónico donde recibirá un enlace con una clave que activara su cuenta. Así de sencillo, quizás algunos se pregunten, ¿Por qué no utilizar django-registration? primero, esto lo hago con fines didácticos, segundo, si alguien quiere tener mas el control de su código esta es la mejor manera, de todas formas estoy abierto a sugerencias y mejoras.&lt;/span&gt;&lt;/span&gt; Bien, luego de esta breve introducción empecemos con el tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
1.- Requisitos de Instalación:&amp;nbsp;&lt;/h4&gt;
Para este ejemplo utilizare algunos programas para facilitar la realización del tutorial, en este caso utilizare &lt;a href=&quot;http://adf.ly/qYxba&quot; target=&quot;_blank&quot;&gt;django-bootstrap3&lt;/a&gt; para instalar mas sencillo el framework de css bootstrap con filtros y tags de Django templates. Y por supuesto como dije previamente instalar django-recaptcha para el captcha en el formulario de registro. Es importante cumplir con los requisitos de recaptcha y generar sus claves para tu sitio web, también puedes crearlas para tu ambiente de desarrollo. ve la documentación de recaptcha. Para instalar estas aplicaciones solo tienes que instalarlas via pip.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;pip install django-bootstrap3 django-recaptcha&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
Revisa la documentación de ambas aplicaciones si quieres obtener mas información.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
2.- Creación del modelo:&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Supongamos que hemos creado el proyecto de Django y dentro de el una aplicación llamada &lt;b&gt;&quot;registro&quot;&lt;/b&gt;, y basándonos en la nueva forma de crear modelos de usuario, creamos &lt;i&gt;models.py&lt;/i&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;from django.db import models&lt;br /&gt;from django.contrib.auth.models import AbstractUser&lt;br /&gt;&lt;br /&gt;class UserRegister(AbstractUser):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; activation_key = models.CharField(max_length=30)&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este caso solo le hemos agregado a la clase abstracta de User un campo adicional, como he comentado brevemente, ustedes pueden crear sus propios modelos de usuario, de acuerdo a sus necesidades. En este caso, solo necesito un campo adicional de los que trae por defecto Django y es un campo para guardar la clave de registro. Luego se agrega el siguiente campo en el archivo &lt;i&gt;settings.py&lt;/i&gt;: &lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;AUTH_USER_MODEL = &#39;registro.UserRegister&#39;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Revisamos que tenemos agregadas las aplicaciones que vamos a utilizar en INSTALLED_APPS como por ejemplo:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;INSTALLED_APPS = (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;bootstrap3&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;registrar&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;captcha&#39;,&lt;br /&gt;)&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Se crea el archivo &lt;i&gt;admin.py&lt;/i&gt;, para poder seguir lo que esta registrando la base de datos por el administrador&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;from django.contrib import admin&lt;br /&gt;from .models import UserRegister&lt;br /&gt;&lt;br /&gt;admin.site.register(UserRegister) &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora creamos la base de datos con el comando &lt;i&gt;python manage.py syncdb&lt;/i&gt;, hasta ahora solo hemos creado una aplicación con el sistema de autenticación por defecto de Django con un campo adicional. Ahora a realizar el sistema de registro de usuarios.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
3.- Registro de Usuarios:&lt;/h4&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Primero vamos a crear el formulario en &lt;i&gt;forms.py&lt;/i&gt; dentro de la aplicación. En principio se importa la clase creada en models.py, y como vamos a usar captcha para validar que no es un robot quien esta tratando de registrarse, importamos también el tipo de campo para el mismo. Creamos la clase heredada de forms y creamos los campos donde el usuario va registrar su clave y el campo captcha.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;# -*- coding: UTF-8 -*-&lt;br /&gt;from django import forms&lt;br /&gt;from .models import UserRegister&lt;br /&gt;from captcha.fields import ReCaptchaField&lt;br /&gt;&lt;br /&gt;class RegistrationForm(forms.ModelForm):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Información de la clave&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; password = forms.CharField(&amp;nbsp;label=&#39;Clave&#39;,&amp;nbsp;widget=forms.PasswordInput()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; password_check = forms.CharField(label=&#39;Ingrese su clave nuevamente&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; widget=forms.PasswordInput()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; captcha = ReCaptchaField(attrs={&#39;theme&#39; : &#39;clean&#39;})&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Agregamos la clase Meta para indicarle a la clase&lt;span style=&quot;font-size: small;&quot;&gt; RegistrationForm con que modelo va trabajar y que campos va mostrar:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;class Meta:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model = UserRegister&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = [&quot;username&quot;, &quot;first_name&quot;, &quot;last_name&quot;, &quot;email&quot;,]&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Ahora creamos los métodos para la clase &lt;span style=&quot;font-size: small;&quot;&gt;RegistrationForm&lt;/span&gt; que haran las validaciones respectivas, asegurándose que las claves coincidan, que el usuario no exista o agreguen caracteres inválidos y evitar correos ya registrados, así nos debe quedar &lt;i&gt;forms.py&lt;/i&gt; completo:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;# -*- coding: UTF-8 -*-&lt;br /&gt;from django import forms&lt;br /&gt;from .models import UserRegister&lt;br /&gt;&lt;br /&gt;import re&lt;br /&gt;from captcha.fields import ReCaptchaField&lt;br /&gt;&lt;br /&gt;class RegistrationForm(forms.ModelForm):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Información de la clave&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; password = forms.CharField(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label=&#39;Clave&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; widget=forms.PasswordInput()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; password_check = forms.CharField(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label=&#39;Ingrese su clave nuevamente&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; widget=forms.PasswordInput()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; captcha = ReCaptchaField(attrs={&#39;theme&#39; : &#39;clean&#39;})&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Meta:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model = UserRegister&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = [&quot;username&quot;, &quot;first_name&quot;, &quot;last_name&quot;, &quot;email&quot;,]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def clean_password_check(self):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&quot;&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Revisar que ambas claves dadas coincidan&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&quot;&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if &#39;password&#39; in self.cleaned_data:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password = self.cleaned_data[&#39;password&#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password_check = self.cleaned_data[&#39;password_check&#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if password == password_check:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return password_check&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise forms.ValidationError(&#39;Claves no coinciden.&#39;)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def clean_username(self):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&quot;&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Chequear que el usuario no exista y validar los caracteres ingresados&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&quot;&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; username = self.cleaned_data[&#39;username&#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not re.search(r&#39;^\w+$&#39;, username):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise forms.ValidationError(&#39;Usuario solo puede contener &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;caracteres alfanumericos y underscore o piso.&#39;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UserRegister.objects.get(username=username)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except UserRegister.DoesNotExist:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return username&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise forms.ValidationError(&#39;Nombre de usuario ya existe&#39;)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def clean_email(self):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&quot;&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Validar que la direccion de correos dada sea unica en el proyecto&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&quot;&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if UserRegister.objects.filter(email__iexact=self.cleaned_data[&#39;email&#39;]).count():&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise forms.ValidationError(u&#39;Esta dirección de correos esta en uso, por favor utilice otra&#39;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return self.cleaned_data[&#39;email&#39;]&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
Ahora en &lt;i&gt;views.py&lt;/i&gt; se crea la clase para el registro de usuario, donde utilizaremos las librerías de Python &lt;i&gt;random y string&lt;/i&gt; para crear la clave de 20 dígitos y grabarla en el campo activation_key que agregamos en el modelo y preparar el correo electrónico con el enlace a ser enviado al nuevo usuario para activar su cuenta, ya que hasta este momento esta registrado pero inactivo. Para esto hay que configurar a Django para que envié correos electrónicos, solo agrega estas lineas en &lt;i&gt;settings.py&lt;/i&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;#Aqui va la configuracion del servidor de correo (en este caso GMAIL)&lt;br /&gt;EMAIL_HOST = &#39;smtp.gmail.com&#39;&lt;br /&gt;EMAIL_PORT = 587&lt;br /&gt;EMAIL_HOST_USER = &#39;usuario@gmail.com&#39;&lt;br /&gt;EMAIL_HOST_PASSWORD = &#39;suclave&#39;&lt;br /&gt;EMAIL_USE_TLS = True&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Así queda views.py&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;# -*- coding: UTF-8 -*-&lt;br /&gt;from django.views.generic import CreateView&lt;br /&gt;from django.core.mail import EmailMultiAlternatives&lt;br /&gt;from django.http import HttpResponseRedirect&lt;br /&gt;import random, string&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;from .models import UserRegister&lt;br /&gt;from .forms import RegistrationForm &lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;class UserCreateView(CreateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; model = UserRegister&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; form_class = RegistrationForm&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/register.html&#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def form_valid(self, form):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; form.instance.is_active = False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; form.instance.activation_key = &#39;&#39;.join(random.choice(string.ascii_uppercase + string.digits)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for n in range(20))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; usuario = form.cleaned_data.get(&#39;email&#39;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html_content = &#39;Por favor visite http://midominio.com/activar/%s/ para activar su cuenta&#39; \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %(form.instance.activation_key)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg = EmailMultiAlternatives(&#39;Código de Activación&#39;,html_content,\&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;registration@midiminio.com&#39;,[usuario])&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg.attach_alternative(html_content,&#39;text/html&#39;) # Definimos el contenido como HTML&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg.send() # Enviamos el correo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return super(UserCreateView, self).form_valid(form)&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora crea &lt;i&gt;urls.py, pero antes agrega la linea en urls.py del proyecto para incluir las urls de la aplicación:&lt;/i&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;#urls.py en el Proyecto&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;from django.conf.urls import patterns, include, url&lt;br /&gt;&lt;br /&gt;from django.contrib import admin&lt;br /&gt;admin.autodiscover()&lt;br /&gt;&lt;br /&gt;urlpatterns = patterns(&#39;&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^register/&#39;, include(&#39;register.urls&#39;)),&amp;nbsp;&lt;span style=&quot;background-color: yellow;&quot;&gt; # Agrega esta linea&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^admin/&#39;, include(admin.site.urls)),&lt;br /&gt;)&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
&lt;i&gt;&amp;nbsp;Crea el archivo urls.py dentro de tu aplicación:&lt;/i&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;from django.conf.urls import patterns, include, url&lt;br /&gt;from .views import *&lt;br /&gt;&lt;br /&gt;urlpatterns = patterns(&#39;.views&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^$&#39;, UserCreateView.as_view(), name=&#39;register&#39;),&lt;br /&gt;)&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
Ahora configura los templates dentro de &lt;i&gt;settings.py&lt;/i&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;TEMPLATE_DIRS = (&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.path.join(BASE_DIR, &quot;templates&quot;),&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;)&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Crea la carpeta templates donde esta manage.py (Esto por supuesto depende de la configuración). Este es un ejemplo como quedaría el árbol del proyecto: &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin-6yp891iN-X-rQknHx3OTwEpreO05dQ48YPHu529O_GEQA0j5s6HINfpj9fLR0T3BEIK1pxNw0jupowX-nwF_dyl3hMpuC30QCZmrmG1sG3wrwCirwStoRNKyqbHWE1sowyRbZ74lm8/s1600/tree.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin-6yp891iN-X-rQknHx3OTwEpreO05dQ48YPHu529O_GEQA0j5s6HINfpj9fLR0T3BEIK1pxNw0jupowX-nwF_dyl3hMpuC30QCZmrmG1sG3wrwCirwStoRNKyqbHWE1sowyRbZ74lm8/s1600/tree.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Crea el template base y lo llamas base.html&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;{% load bootstrap3 %}&lt;br /&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {# Load CSS and JavaScript #}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% bootstrap_css %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% bootstrap_javascript %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;{% block title %}Ejemplo{% endblock %}&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div class=&quot;container&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% block body_block %}This is body_block&#39;s default content.{% endblock %}&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Este template carga primeramente bootstrap3 gracias a la aplicación que cargamos al principio django-bootstrap3. Ahora crea el formulario, en este caso podemos crear una carpeta para ordenar los templeates de acuerdo a la aplicación que pertenecen&lt;i&gt;:&lt;/i&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{% extends &#39;base.html&#39; %}&lt;br /&gt;{% load bootstrap3 %}&lt;br /&gt;&lt;br /&gt;{% block title %}Formulario de Registro{% endblock %}&lt;br /&gt;&lt;br /&gt;{# Display django.contrib.messages as Bootstrap alerts #}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% bootstrap_messages %}&lt;br /&gt;&lt;br /&gt;{# Display a form #}&lt;br /&gt;{% block body_block %}&lt;br /&gt;&amp;lt;form action=&quot;&quot; method=&quot;post&quot; class=&quot;form&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% csrf_token %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% bootstrap_form form %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% buttons %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% bootstrap_icon &quot;star&quot; %} Submit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/button&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {% endbuttons %}&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;{% endblock %}&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;/blockquote&gt;
Arrancamos el servidor y colocamos la dirección &lt;i&gt;http://127.0.0.1:8000/register/&lt;/i&gt; en el navegador.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz5CdAIxYjLBF8TQcdlOH6SZvz9jPMyciMeht4z6OO4_iDgonlfhDHl_a6DVH1GxTyqDz1GnF5hfyZTKNw_wWSz_BXR6gLPP9NfZtF6tT3oEMxYjXFH7qZSZDFI4zb_OZqnJeaNhSZ2Lw/s1600/register.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz5CdAIxYjLBF8TQcdlOH6SZvz9jPMyciMeht4z6OO4_iDgonlfhDHl_a6DVH1GxTyqDz1GnF5hfyZTKNw_wWSz_BXR6gLPP9NfZtF6tT3oEMxYjXFH7qZSZDFI4zb_OZqnJeaNhSZ2Lw/s1600/register.png&quot; height=&quot;274&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Registramos el primer usuario él cual enviara el correo electrónico y al revisar por admin y vemos que el usuario existe, solo que esta inactivo. El cuerpo del correo sera:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Por favor visite http://midominio/activar/MNP54P4WB50W4N9NJIXG/ para activar su cuenta&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para activarlo, crea una clase en &lt;i&gt;views.py&lt;/i&gt; que recibirá por la url el código de activación enviado al correo electrónico del usuario.&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;class ActivteUserView(View):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def dispatch(self, *args, **kwargs):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.codigo = self.kwargs[&#39;codigo&#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return super(ActivteUserView, self).dispatch(*args, **kwargs)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def get(self, request, *args, **kwargs):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.usuario = UserRegister.objects.get(activation_key=self.codigo)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.usuario.is_active == False:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.usuario.is_active = True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.usuario.save()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return HttpResponseRedirect(&quot;/register/activo_exito/&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return HttpResponseRedirect(&quot;/register/activo/&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except UserRegister.DoesNotExist:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return HttpResponseRedirect(&#39;/register/error_activacion&#39;)&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Como se ve en el codigo tenemos unas redirecciones en cada caso, si tuvo exito, si ya esta registrado o simplemente un codigo errado, para ellos creamos las vistas necesarias.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;class ErrorActiveView(TemplateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/error_activacion.html&#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;class UserActiveErrorView(TemplateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/usuario_ya_activo.html&#39;&lt;br /&gt;&lt;br /&gt;class UserActiveView(TemplateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/usuario_activo.html&#39;&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Hay que importar las nuevas clases utilizadas: &lt;i&gt;TemplateView y View&lt;/i&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;from django.views.generic import CreateView, TemplateView, View&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
Así queda &lt;i&gt;views.py&lt;/i&gt; completo: &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;# -*- coding: UTF-8 -*-&lt;br /&gt;from django.views.generic import CreateView, TemplateView, View&lt;br /&gt;from django.core.mail import EmailMultiAlternatives&lt;br /&gt;from django.http import HttpResponseRedirect&lt;br /&gt;import random, string&lt;br /&gt;&lt;br /&gt;from .models import UserRegister&lt;br /&gt;from .forms import RegistrationForm&lt;br /&gt;&lt;br /&gt;class ErrorActiveView(TemplateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/error_activacion.html&#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;class UserActiveErrorView(TemplateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/usuario_ya_activo.html&#39;&lt;br /&gt;&lt;br /&gt;class UserActiveView(TemplateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/usuario_activo.html&#39;&lt;br /&gt;&lt;br /&gt;class UserCreateView(CreateView):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; model = UserRegister&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; form_class = RegistrationForm&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template_name = &#39;register/register.html&#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def form_valid(self, form):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; form.instance.is_active = False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; form.instance.activation_key = &#39;&#39;.join(random.choice(string.ascii_uppercase + string.digits)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for n in range(20))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; usuario = form.cleaned_data.get(&#39;email&#39;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html_content = &#39;Por favor visite http://midominio.com/activar/%s/ para activar su cuenta&#39; \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %(form.instance.activation_key)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg = EmailMultiAlternatives(&#39;Código de Activación&#39;,html_content,\&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;registration@&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;midominio.com&lt;/span&gt;&lt;/i&gt;&#39;,[usuario])&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg.attach_alternative(html_content,&#39;text/html&#39;) # Definimos el contenido como HTML&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg.send() # Enviamos el correo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return super(UserCreateView, self).form_valid(form)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;class ActivteUserView(View):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def dispatch(self, *args, **kwargs):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.codigo = self.kwargs[&#39;codigo&#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return super(ActivteUserView, self).dispatch(*args, **kwargs)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def get(self, request, *args, **kwargs):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.usuario = UserRegister.objects.get(activation_key=self.codigo)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.usuario.is_active == False:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.usuario.is_active = True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.usuario.save()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return HttpResponseRedirect(&quot;/register/activo_exito/&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return HttpResponseRedirect(&quot;/register/activo/&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except UserRegister.DoesNotExist:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return HttpResponseRedirect(&#39;/register/error_activacion&#39;) &lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Agregamos las urls que faltan en &lt;i&gt;urls.py&lt;/i&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;from django.conf.urls import patterns, include, url&lt;br /&gt;from .views import *&lt;br /&gt;&lt;br /&gt;urlpatterns = patterns(&#39;.views&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^$&#39;, UserCreateView.as_view(), name=&#39;register&#39;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^activar/(?P&amp;lt;codigo&amp;gt;.+)/$&#39;, ActivteUserView.as_view(), name=&#39;activar_user&#39;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^activo/$&#39;, UserActiveErrorView.as_view(), name=&#39;activo&#39;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^activo_exito/$&#39;, UserActiveView.as_view(), name=&#39;exito_activo&#39;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^error_activacion/$&#39;, ErrorActiveView.as_view(), name=&#39;error_activacion&#39;),&lt;br /&gt;)&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Se realizan los templates html faltantes:&lt;br /&gt;
error_activacion.html: &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{% extends &#39;base.html&#39; %}&lt;br /&gt;{% load bootstrap3 %}&lt;br /&gt;&lt;br /&gt;{% block title %}Error de Activacion{% endblock %}&lt;br /&gt;&lt;br /&gt;{# Display a form #}&lt;br /&gt;{% block body_block %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div class=&quot;container&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h1 class=&quot;text-muted&quot;&amp;gt;Error en Activacion&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;{% endblock %}&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
usuario_activo.html&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{% extends &#39;base.html&#39; %}&lt;br /&gt;{% load bootstrap3 %}&lt;br /&gt;&lt;br /&gt;{% block title %}Usuario Activo{% endblock %}&lt;br /&gt;&lt;br /&gt;{# Display a form #}&lt;br /&gt;{% block body_block %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div class=&quot;container&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h1 class=&quot;text-muted&quot;&amp;gt;Usuario Activo&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;{% endblock %}&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
usuario_ya_activo.html:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;{% extends &#39;base.html&#39; %}&lt;br /&gt;{% load bootstrap3 %}&lt;br /&gt;&lt;br /&gt;{% block title %}Error de Activacion{% endblock %}&lt;br /&gt;&lt;br /&gt;{# Display a form #}&lt;br /&gt;{% block body_block %}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div class=&quot;container&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h1 class=&quot;text-muted&quot;&amp;gt;Error, Usuario ya activo&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;{% endblock %} &lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Revisamos nuevamente por admin y veremos que el usuario aparece tildado activo y ya puedes controlar el sitio solo para usuarios registrados. Espero que sea de utilidad y no duden en dejar sus comentarios. Hasta la próxima.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/524085542138271726/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2014/06/registro-de-usuarios-para-un-sitio-web.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/524085542138271726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/524085542138271726'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2014/06/registro-de-usuarios-para-un-sitio-web.html' title='Registro de Usuarios para un sitio web con Django 1.6 usando Class Based Views y reCAPTCHA'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin-6yp891iN-X-rQknHx3OTwEpreO05dQ48YPHu529O_GEQA0j5s6HINfpj9fLR0T3BEIK1pxNw0jupowX-nwF_dyl3hMpuC30QCZmrmG1sG3wrwCirwStoRNKyqbHWE1sowyRbZ74lm8/s72-c/tree.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-7686071820972238406</id><published>2013-10-09T16:43:00.000-07:00</published><updated>2014-07-24T18:31:12.947-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Centos"/><category scheme="http://www.blogger.com/atom/ns#" term="Deploy Django"/><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="django-1.5"/><category scheme="http://www.blogger.com/atom/ns#" term="Gunicorn"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Nginx"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="Supervisor"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Django en Producción con Centos, PostgreSQL, Virtualenv, Gunicorn, Nginx y Supervisor</title><content type='html'>&lt;div class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este articulo vamos llevar a un entorno de Producción nuestra aplicación que creamos con Django, para ello vamos a utilizar varias herramientas:&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Nos basaremos en el sistema operativo Centos 6.4 que es el clon libre del Red Hat Enterprise Server, un sistema operativo Linux hecho para servidores. en el caso de otras distribuciones de Linux, solo busca como instalar los paquetes y donde están ubicados sus archivos de configuración.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Puedes hacer esto en un servidor local, o puedes utilizar cualquiera de los proveedores que dan servicio de VPS.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Voy a asumir que usted conoce o sabe como configurar su servidor para apuntar un dominio a la dirección IP del servidor.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
1.- Crear un usuario donde va estar nuestro proyecto y darle permisos de Administrador&lt;/h4&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;como usuario root, ejecutamos:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]#&amp;nbsp;&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;useradd django&lt;/span&gt;&lt;/blockquote&gt;
luego editamos el archivo /etc/sudoers, con tu editor de preferencia&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# vim /etc/sudoers&lt;/blockquote&gt;
allí agrega debajo de la linea donde esta root:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
## Allow root to run any commands anywhere&lt;br /&gt;
root &amp;nbsp; &amp;nbsp;ALL=(ALL) &amp;nbsp; &amp;nbsp; &amp;nbsp; ALL&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;django &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ALL=(ALL) &amp;nbsp; &amp;nbsp; &amp;nbsp; ALL&lt;/span&gt;&lt;/blockquote&gt;
&lt;h4&gt;
2.- Instalar PostgreSQL&lt;/h4&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;text-align: justify;&quot;&gt;Yo particularmente recomiendo que cuando este en el proceso de instalación de Centos, escoge la opción de Servidor de Base de datos, para tener ya PostgreSQL instalado, en caso contrario, instalarlo con el siguiente comando:&lt;/span&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# &amp;nbsp;yum install postgresql postgresql-server postgresql-contrib&lt;/blockquote&gt;
Ahora iniciamos el servidor PostgreSQL&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;[root@localhost ~]# service postgresql initdb&lt;/blockquote&gt;
Arrancamos el servicio:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;[root@localhost ~]# service postgresql start&lt;/blockquote&gt;
Y lo configuramos para que arranque cada vez que iniciemos el servidor:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;[root@localhost ~]# chkconfig postgresql on&lt;/blockquote&gt;
Luego configuramos los archivos &lt;i&gt;pg_hba.conf &lt;/i&gt;y&lt;i&gt; postgres.conf&lt;/i&gt; para poder conectarnos al PostgreSQL, por favor revise la documentación para ver las opciones de configuración para su servidor. Editamos postgres.conf&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# vi /var/lib/pgsql/data/postgresql.conf&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Descomentar las siguientes lineas y agregamos * en la variable &lt;i&gt;listen_addresses&lt;/i&gt;&amp;nbsp;si queremos administrar nuestro PostgreSQL desde cualquier equipo:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
listen_addresses = &#39;*&#39;&lt;br /&gt;
port = 5432&lt;/blockquote&gt;
Ahora editamos&amp;nbsp;pg_hba.conf:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# vi /var/lib/pgsql/data/pg_hba.conf&lt;/blockquote&gt;
Y cambiamos la siguiente linea por esto:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;# TYPE &amp;nbsp;DATABASE &amp;nbsp; &amp;nbsp;USER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CIDR-ADDRESS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;METHOD&lt;br /&gt;
# &quot;local&quot; is for Unix domain socket connections only&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;local &amp;nbsp; all &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; all &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; trust&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Ahora reiniciamos nuestro servicio:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# service postgresql restart&lt;/blockquote&gt;
Le asignamos una clave al usuario que viene por defecto llamado postgres en la Base de Datos&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# su postgres&lt;br /&gt;
bash-4.1$&lt;br /&gt;
bash-4.1$ psql&lt;br /&gt;
could not change directory to &quot;/root&quot;&lt;br /&gt;
psql (8.4.13)&lt;br /&gt;
Type &quot;help&quot; for help.&lt;br /&gt;
postgres=# ALTER ROLE postgres WITH PASSWORD &#39;abc123&#39;;&lt;br /&gt;
postgres=# \q&lt;br /&gt;
bash-4.1$&lt;/blockquote&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este caso se le asigno la clave abc123, coloque la que mas le conviene.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y esta nuestro servidor funcionando, ahora creamos nuestro usuario y base de datos para nuestra aplicación:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
bash-4.1$ createuser django -P&lt;br /&gt;
could not change directory to &quot;/root&quot;&lt;br /&gt;
Enter password for new role:&lt;br /&gt;
Enter it again:&lt;br /&gt;
Shall the new role be a superuser? (y/n) n&lt;br /&gt;
Shall the new role be allowed to create databases? (y/n) n&lt;br /&gt;
Shall the new role be allowed to create more new roles? (y/n) n&lt;br /&gt;
bash-4.1$&amp;nbsp;&lt;/blockquote&gt;
&lt;div&gt;
Ya tenemos creado el usuario django en PostgreSQL, ese es el usuario que colocaremos en el archivo settings.py de Django, ahora creamos la base de datos de nuestra aplicación:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
bash-4.1$&amp;nbsp;psql&lt;br /&gt;
could not change directory to &quot;/root&quot;&lt;br /&gt;
psql (8.4.13)&lt;br /&gt;
Type &quot;help&quot; for help.&lt;br /&gt;
postgres=# CREATE DATABASE mibasedatos OWNER django;&lt;br /&gt;
GRANT&lt;br /&gt;
postgres=# \q&lt;br /&gt;
bash-4.1$ exit&lt;/blockquote&gt;
&lt;h4&gt;
3.- Instalar el repositorio EPEL (Extra Packages for Enterprise Linux):&lt;/h4&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6&lt;br /&gt;
[root@localhost ~]# rpm --import&amp;nbsp;RPM-GPG-KEY-EPEL-6&lt;br /&gt;
[root@localhost ~]# rm -f&amp;nbsp;&amp;nbsp;RPM-GPG-KEY-EPEL-6&lt;/blockquote&gt;
Instalamos en este caso para Centos de 64:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# wget http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm&lt;br /&gt;
[root@localhost ~]# rpm -ivh&amp;nbsp;epel-release-6-8.noarch.rpm&lt;br /&gt;
[root@localhost ~]# yum update&lt;/blockquote&gt;
&lt;h4&gt;
4.- Instalamos Nginx&lt;/h4&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# yum install nginx&lt;/blockquote&gt;
Arrancamos el servicio y lo configuramos para que arranque cada vez que inicie la maquina:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# service nginx start&lt;br /&gt;
[root@localhost ~]# chkconfig nginx on&lt;/blockquote&gt;
Nota: debemos inhabilitar el firewall que viene por defecto o configurar para acepte peticiones, en nuestro caso lo vamos a inhabilitar:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# service iptables stop&lt;/blockquote&gt;
Probamos nuestro servidor Web en nuestro navegador: http://localhost&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
5.- Instalar Python y librerías necesarias&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Instalamos Python y las librerías y componentes necesarios para que nuestra aplicación funcione correctamente con PostgreSQL&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# yum install python python-devel python-setuptools python-pip libxml2-devel&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ademas vamos a instalar gcc, el compilador de C y postgresql-devel. que nos lo exige el &lt;i&gt;psycopg2&lt;/i&gt; para conectarnos desde Django a PostgreSQL&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# yum install gcc postgresql-devel&lt;/blockquote&gt;
&lt;br /&gt;
&lt;h4&gt;
6.- Instalación de Virtualenv&amp;nbsp;&lt;/h4&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
Para instalar virtualenv, utilizamos pip, ya aquí podemos ingresar con nuestro usuario que creamos al principio:&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCmx79-9IQlf5AONcimFgIpCMLyPmHcvF5LrPVfYqKp61NMx9KkQTOMTr1OZzgQQV4CUVAprfcxGQwX4wPivVHOFwoNC-TFPQZke2b9YUZwQRKP0dHaOsHPVOgzaO-Ws2VrhMMbnEkjTg/s1600/login.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCmx79-9IQlf5AONcimFgIpCMLyPmHcvF5LrPVfYqKp61NMx9KkQTOMTr1OZzgQQV4CUVAprfcxGQwX4wPivVHOFwoNC-TFPQZke2b9YUZwQRKP0dHaOsHPVOgzaO-Ws2VrhMMbnEkjTg/s400/login.png&quot; height=&quot;136&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ sudo pip install virtualenv&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Al terminar de instalar, procedemos a crear nuestro ambiente para la aplicación que vamos colocar en producción:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ virtualenv ~/env&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Para activar ejecutamos:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ source ~/env/bin/activate&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Y miren como nos cambia el prompt&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost ~]$&amp;nbsp;&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Todo lo que instalemos aquí vía pip, solo estará en este ambiente, esto es muy útil cuando vamos a tener varias aplicaciones con diferentes versiones de Django&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
7.- Instalamos Django,&amp;nbsp;psycopg2 y nuestra aplicación&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Dentro de nuestro ambiente virtual, este pendiente que tengamos en el prompt los paréntesis con nuestro ambiente &quot;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;(env)&lt;/b&gt;&lt;/span&gt;[django@localhost ~]$&quot;, instalamos lo que requerimos para nuestra aplicación, primero por supuesto Django:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;(env)[django@localhost ~]$ pip install django&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
La librería para conectarnos a PostgreSQL:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost ~]$ pip install&amp;nbsp;psycopg2&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
La aplicación la copiamos al directorio que queramos, puede ser en /opt/webapps, o donde ustedes lo consideren:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost ~]$ sudo mkdir -p /opt/webapps&lt;br /&gt;
[sudo] password for django:&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Lo mas importante es que el directorio tenga permiso de lectura:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
drwxr-xr-x. 4 root root 4096 oct &amp;nbsp;9 19:31 /opt&lt;/blockquote&gt;
Cambiamos el usuario de la carpeta webapps:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost ~]$cd /opt&lt;br /&gt;
(env)[django@localhost opt]$ sudo chown django:nginx webapps&lt;br /&gt;
[sudo] password for django:&lt;/blockquote&gt;
&amp;nbsp;Solo para probar creamos una aplicación en Django:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;(env)[django@localhost opt]$ cd webapps/&lt;br /&gt;
(env)[django@localhost webapps]$ django-admin.py startproject demo&lt;br /&gt;
(env)[django@localhost webapps]$ cd demo&lt;br /&gt;
(env)[django@localhost demo]$ python manage.py runserver&lt;br /&gt;
Validating models...&lt;br /&gt;
0 errors found&lt;br /&gt;
October 09, 2013 - 19:12:55&lt;br /&gt;
Django version 1.5.4, using settings &#39;demo.settings&#39;&lt;br /&gt;
Development server is running at http://127.0.0.1:8000/&lt;br /&gt;
Quit the server with CONTROL-C.&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ya podemos ver que nuestro servidor de desarrollo funciona en nuestro navegador con http://127.0.0.1:8000&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Nos queda configurar Django con la Base de datos y podemos empezar a crear las tablas de nuestra aplicación:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
DATABASES = {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;default&#39;: {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;ENGINE&#39;: &#39;django.db.backends.postgresql_psycopg2&#39;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;NAME&#39;: &#39;mibasedatos&#39;, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;USER&#39;: &#39;django&#39;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;PASSWORD&#39;: &#39;abc123&#39;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;HOST&#39;: &#39;localhost&#39;, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;PORT&#39;: &#39;&#39;, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;/blockquote&gt;
Solo queda que montes tu aplicación y crear las tablas de tu base de datos en el servidor, ahora a configurar Gunicorn y Nginx:&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
8.- Instalando y configurando Gunicorn&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;a href=&quot;http://adf.ly/qYyF4&quot; target=&quot;_blank&quot;&gt;Gunicorn&lt;/a&gt; es también conocido como Green Unicorn (Unicornio Verde), es un servidor WSGI HTTP para Python. Es un pre-fork del proyecto Unicorn de Ruby. Gunicorn es compatible con varios frameworks, soporta WSGI, Django y Paster de forma nativa; consume pocos recursos en ejecución y es bastante rápido. Aquí solo voy a tratar lo básico, cualquier configuración adicional, por favor busque la &lt;a href=&quot;http://adf.ly/qYyHY&quot; target=&quot;_blank&quot;&gt;documentación&lt;/a&gt;. Para instalarlo:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost opt]$ pip install gunicorn&lt;/blockquote&gt;
Probemos nuestra pequeña aplicación con Gunicorn:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost demo]$ gunicorn -w3 demo.wsgi:application --bind 127.0.0.1:8000&lt;br /&gt;
2013-10-09 20:14:49 [8571] [INFO] Starting gunicorn 18.0&lt;br /&gt;
2013-10-09 20:14:49 [8571] [INFO] Listening at: http://127.0.0.1:8000 (8571)&lt;br /&gt;
2013-10-09 20:14:49 [8571] [INFO] Using worker: sync&lt;br /&gt;
2013-10-09 20:14:49 [8576] [INFO] Booting worker with pid: 8576&lt;br /&gt;
2013-10-09 20:14:49 [8577] [INFO] Booting worker with pid: 8577&lt;br /&gt;
2013-10-09 20:14:49 [8578] [INFO] Booting worker with pid: 8578&lt;/blockquote&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora podemos probar en nuestro navegador&amp;nbsp;&amp;nbsp;http://127.0.0.1:8000 y allí tenemos nuestra aplicación corriendo en un servidor&amp;nbsp;WSGI HTTP&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El comando gunicorn ofrece una extensa lista de opciones para configurar su comportamiento, pero las que he utilizado en esta oportunidad son:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;-w INT:&lt;/b&gt; número de procesos workers que se arrancarán para servir las peticiones.Este&amp;nbsp;dependerá en medida de la carga de trabajo que tenga la aplicación, también depende del hardware con que se cuente, de acuerdo a la siguiente formula: 2*CPU&amp;nbsp;+1, Para las maquinas que tienen un solo procesador escriba 3.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;demo.wsgi:application:&lt;/b&gt; la ubicación del archivo wsgi.py y escribimos después de los dos puntos&amp;nbsp;application&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;--bind ADDRESS&lt;/b&gt;: es posible especificar tanto HOST:PUERTO para decirle a gunicorn por donde va recibir peticiones&lt;/div&gt;
&lt;br /&gt;
Bien, hagamos un script para que levante el entorno virtual y ejecute nuestra aplicación con Gunicorn. lo creamos en nuestro home&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost opt]$ cd&lt;br /&gt;
(env)[django@localhost opt]$ vi gunicorn_start.sh&lt;/blockquote&gt;
y escribimos en nuestro archivo:&lt;br /&gt;
&lt;blockquote&gt;
#!/bin/sh&lt;br /&gt;
NAME=&quot;demo&quot;&lt;br /&gt;
DJANGODIR=&quot;/opt/webapps/demo&quot;&lt;br /&gt;
NUM_WORKERS=3&lt;br /&gt;
echo &quot;Arrancando Demo&quot;&lt;br /&gt;
cd $DJANGODIR&lt;br /&gt;
source ~/env/bin/activate&lt;br /&gt;
exec gunicorn -w $NUM_WORKERS $NAME.wsgi:application --bind 127.0.0.1:8000&lt;/blockquote&gt;
Salimos del ambiente virtual y ejecutamos para probarlo:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
(env)[django@localhost ~]$ deactivate&lt;br /&gt;
[django@localhost ~]$&amp;nbsp;chmod +x gunicorn_start.sh&lt;br /&gt;
[django@localhost ~]$ ./gunicorn_start.sh&lt;br /&gt;
Arrancando Demo&lt;br /&gt;
2013-10-09 20:41:26 [8686] [INFO] Starting gunicorn 18.0&lt;br /&gt;
2013-10-09 20:41:26 [8686] [INFO] Listening at: http://127.0.0.1:8000 (8686)&lt;br /&gt;
2013-10-09 20:41:26 [8686] [INFO] Using worker: sync&lt;br /&gt;
2013-10-09 20:41:26 [8695] [INFO] Booting worker with pid: 8695&lt;br /&gt;
2013-10-09 20:41:26 [8696] [INFO] Booting worker with pid: 8696&lt;br /&gt;
2013-10-09 20:41:26 [8697] [INFO] Booting worker with pid: 8697&lt;/blockquote&gt;
&lt;div&gt;
Como podemos ver nos queda nuestro terminal con la aplicación y no nos deja hacer mas nada y si lo cerramos, se cae la aplicación, esto lo vamos a resolver con &lt;a href=&quot;http://adf.ly/qYyIy&quot; target=&quot;_blank&quot;&gt;Supervisor&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
9.- Instalando y Configurando Supervisor&lt;/h4&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
Supervisor es un sistema cliente servidor que permite a los usuarios monitorear y controlar una serie de procesos en los sistemas operativos tipo UNIX.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Comparte algunos de los mismos objetivos de los programas como launchd , daemontools y runit . A diferencia de algunos de estos programas, no está diseñada para ejecutarse como un sustituto de init. En cambio, está destinado a ser utilizado para el control de procesos relacionados con un proyecto o un cliente, y está destinado a iniciar como cualquier otro programa en el arranque.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
le damos Ctrl-C, para salir de Gunicorn y liberar la terminal, instalamos ahora Supervisor con yum:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ sudo yum install supervisor&lt;/blockquote&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Una vez instalado configuramos supervisor para nuestra aplicación en /etc/supervisord.conf. Hay que hacerlo como root:&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ su -&lt;br /&gt;
Contraseña:&lt;br /&gt;
[root@localhost ~]# vi /etc/supervisord.conf&lt;/blockquote&gt;
&lt;div&gt;
Agregamos lo siguiente al final del archivo:&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[program:demo]&lt;br /&gt;
command=/home/django/gunicorn_start.sh&lt;br /&gt;
user=django&lt;br /&gt;
autostart=true&lt;br /&gt;
stdout_logfile=/opt/webapps/demo/logs/gunicorn_supervisor.log&lt;br /&gt;
redirect_stderr=true&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
Creamos la carpeta y archivo para los logs:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[root@localhost ~]# exit&lt;br /&gt;
[django@localhost ~]$ mkdir -p /opt/webapps/demo/logs&lt;br /&gt;
[django@localhost ~]$ touch&amp;nbsp;/opt/webapps/demo/logs/gunicorn_supervisor.log&lt;/blockquote&gt;
Arrancamos Supervisor y lo configuramos para que arranque siempre&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ sudo service supervisord start&lt;br /&gt;
[django@localhost ~]$ sudo chkconfig&amp;nbsp;supervisord on&lt;/blockquote&gt;
&lt;div&gt;
Reiniciamos el servicio propiamente de Supervisor:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$sudo supervisorctl reload&lt;br /&gt;
Restarted supervisord&lt;/blockquote&gt;
Y ahora veremos nuestra aplicación corriendo:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ sudo supervisorctl status demo&lt;br /&gt;
[sudo] password for django:&lt;br /&gt;
demo &amp;nbsp; &amp;nbsp;RUNNING &amp;nbsp; &amp;nbsp;pid 8883, uptime 0:11:29&lt;/blockquote&gt;
Para detenerla:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ sudo supervisorctl stop demo&lt;/blockquote&gt;
&lt;div&gt;
&lt;div&gt;
Para reiniciarla:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ sudo supervisorctl restart demo&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
Listo ya tenemos nuestra aplicación lista para que arranque al iniciar el servidor&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
10.- Configuración de Nginx&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Buscamos el archivo de configuración de nginx en /etc/nginx/conf.d llamado default.conf y lo cambiamos totalmente por esto:&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
server {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; listen 80;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; server_name ejemplo.com;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; access_log &amp;nbsp;/var/log/nginx/server.log;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; root /opt/webapps/demo;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; location /static/ {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;autoindex on;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;alias &amp;nbsp;/opt/webapps/demo/static/;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; location /media/ {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;autoindex on;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;alias &amp;nbsp;/opt/webapps/demo/media/;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; location / {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; proxy_pass http://127.0.0.1:8000;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; proxy_set_header Host $host;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; proxy_set_header X-Real-IP $remote_addr;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; }&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Lo importante, tu carpeta static y media, es importante colocar la ruta exacta hacia esos archivos, de lo contrario, no te permitirá ver los estilos de tu aplicación. Otra cosa importante es la dirección por donde esta sirviendo tu aplicación el Gunicorn.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Reiniciamos nuestro servicio de Nginx y a probar nuestra aplicación&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
[django@localhost ~]$ sudo service nginx start&lt;/blockquote&gt;
&lt;div&gt;
Listo, espero sus comentarios y sugerencias, hasta la próxima.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/7686071820972238406/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/10/django-en-produccion-con-centos.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/7686071820972238406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/7686071820972238406'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/10/django-en-produccion-con-centos.html' title='Django en Producción con Centos, PostgreSQL, Virtualenv, Gunicorn, Nginx y Supervisor'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCmx79-9IQlf5AONcimFgIpCMLyPmHcvF5LrPVfYqKp61NMx9KkQTOMTr1OZzgQQV4CUVAprfcxGQwX4wPivVHOFwoNC-TFPQZke2b9YUZwQRKP0dHaOsHPVOgzaO-Ws2VrhMMbnEkjTg/s72-c/login.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-8256199656471204969</id><published>2013-09-29T19:47:00.000-07:00</published><updated>2013-09-29T19:47:08.706-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="autocomplete"/><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="ForeignKey"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><title type='text'>jQuery Autocomplete en Django</title><content type='html'>&lt;div class=&quot;tr_bq&quot; style=&quot;text-align: justify;&quot;&gt;
Hola todos, esta vez vamos hacer algo muy útil cuando tenemos un campo estilo&amp;nbsp;ForeignKey y se nos hace muy grande cuando tenemos muchos datos, como sabemos un campo&amp;nbsp;ForeignKey nos hace un campo select en el formulario.&lt;/div&gt;
&lt;br /&gt;
Tenemos el siguiente modelo:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
class Persona(models.Model):&lt;br /&gt;&amp;nbsp; &amp;nbsp; cedula = models.CharField(unique=True, max_length=10)&lt;br /&gt;&amp;nbsp; &amp;nbsp; nombres = models.CharField(verbose_name=&#39;Nombres&#39;, max_length=60)&lt;br /&gt;&amp;nbsp; &amp;nbsp; apellidos = models.CharField(verbose_name=&#39;Apellidos&#39;, max_length=60)&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
class Proyecto(models.Model):&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;titulo = models.CharField(max_length=200)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;autor = models.ForeignKey(Persona)&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora vamos a crear el forms.py, donde vamos a crear un campo adicional, que vamos a llamar persona_display:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
class ProyectoForm(forms.ModelForm):&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;persona_display = forms.CharField(max_length=100, help_text=&#39;tipee Cedula, Nombre o Apellido&#39;)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;class_Meta:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; model = Proyecto&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fields=(&#39;titulo&#39;, &#39;persona_display&#39;, &#39;autor&#39;,)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;def __init__(self, *args, **kwargs):&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super(ProyectoForm, self).__init__(*args, **kwargs)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.field[&#39;persona_display&#39;].label = &quot;Agrege el Autor&quot;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.fields[&#39;autor&#39;].widget = forms.HiddenInput()&lt;/blockquote&gt;
&lt;b&gt;¿Qué hemos hecho hasta aquí?&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Primero creamos nuestro formulario donde agregamos un campo adicional llamado persona_display, en el constructor de la clase hemos dado algunas características al campo persona lo hemos ocultado y le hemos agregado una etiqueta al nuevo campo&amp;nbsp;persona_display&lt;/div&gt;
&lt;br /&gt;
Ahora creamos nuestra url en urls.py:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
url(r&#39;^persona/autocomplete/$&#39;, &#39;persona_auto_complete&#39;, name=&#39;persona_auto_complete&#39;),&lt;/blockquote&gt;
Ahora la vista en views.py:&lt;br /&gt;
&lt;blockquote&gt;
&amp;nbsp;def persona_auto_complete(request):&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;q = request.REQUEST[&#39;term&#39;]&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if q:&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;qset = (&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Q(cedula__istartswith=q) |&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Q(nombres__icontains=q) |&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Q(apellidos__icontains=q)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;personas = Persona.objects.filter(qset).distinct()&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;else:&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;personas = []&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;personas_list = []&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for p in personas:&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;value = &#39;%s, (%s, %s)&#39; % (p.cedula, p.nombres, p.apellidos)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;p_dict = {&#39;id&#39;: p.id, &#39;label&#39;: value, &#39;value&#39;: value}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;personas_list.append(p_dict)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return HttpResponse(simplejson.dumps(personas_list))&lt;/blockquote&gt;
Ahora podemos probar lo que hemos hecho, escribiendo en nuestro navegador:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
http://localhost:8000/persona/autocomplete/?term=an&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este caso estamos buscando las personas que contengan en el nombre o apellido las letras &quot;an&quot; y nos mostrara un resultado como este:&lt;/div&gt;
&lt;br /&gt;
[{&quot;id&quot;: 3, &quot;value&quot;: &quot;1234567, (Ana Cecilia, La Cruz)&quot;, &quot;label&quot;: &quot;1234567, (Ana Cecilia, La Cruz)&quot;}]&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si tenemos este resultado, ya podemos ahora agregar el código JQuery del plugin AutoComplete en nuestro template:&lt;/div&gt;
&lt;br /&gt;
Recuerde que debe agregar los css del Jquery:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css&quot;&amp;gt;&lt;/blockquote&gt;
el formulario:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;{% csrf_token %}&lt;br /&gt;&amp;lt;div class=&quot;forms&quot;&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; {{ form }}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Salvar&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;/blockquote&gt;
Y ahora el JQuery y JQuery UI con el script de que hace accionar nuestro autocomplete:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src=&quot;http://code.jquery.com/ui/1.10.3/jquery-ui.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;script&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$( document ).ready( function() {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$(&quot;#id_persona_display&quot;).autocomplete({&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;source: &quot;{% &amp;nbsp;url &#39;persona_auto_complete&#39; %}&quot;,&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;dataType: &quot;jsonp&quot;,&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;selectFirst: true,&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;minLength: 2,&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select: function(event,ui) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$(&quot;#id_autor&quot;).val(ui.item.id)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;});&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/script&amp;gt;&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Explicando un poco, estamos activando el auto complete en el campo que creamos en el form.py llamado persona_display, llamamos la url del autocomplete en la vista y le decimos por el parámetro&amp;nbsp;minLength que empiece a buscar a partir del segundo carácter y al escoger le agregamos el id al campo autor, para que no nos de error, ya que es un campo requerido por ser clave.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV10QtbMI8kSABaTcrIE1XFB0Fq4E8fypqdTiWNeGS4HiQR9PKr132YoHwB-f7gRtMdPKrDDEo5r9wd-Kb8O8CSSVbxZsdIUuqCauNWzeShXCp0yrB4IvgsdmvzbAmMw6MjWduzkmfJhQ/s1600/autocomplete.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV10QtbMI8kSABaTcrIE1XFB0Fq4E8fypqdTiWNeGS4HiQR9PKr132YoHwB-f7gRtMdPKrDDEo5r9wd-Kb8O8CSSVbxZsdIUuqCauNWzeShXCp0yrB4IvgsdmvzbAmMw6MjWduzkmfJhQ/s400/autocomplete.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Este es un ejemplo de como nos quedara el autocomplete,&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y eso es todo, espero que les sirva y lo pongan en practica en sus proyectos. Espero sus comentarios. Hasta la próxima.&lt;/div&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/8256199656471204969/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/09/jquery-autocomplete-en-django.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/8256199656471204969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/8256199656471204969'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/09/jquery-autocomplete-en-django.html' title='jQuery Autocomplete en Django'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV10QtbMI8kSABaTcrIE1XFB0Fq4E8fypqdTiWNeGS4HiQR9PKr132YoHwB-f7gRtMdPKrDDEo5r9wd-Kb8O8CSSVbxZsdIUuqCauNWzeShXCp0yrB4IvgsdmvzbAmMw6MjWduzkmfJhQ/s72-c/autocomplete.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-1538693138100968273</id><published>2013-09-17T19:36:00.000-07:00</published><updated>2013-09-17T19:36:23.124-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="django-1.5"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Chequear disponibilidad de Campo Clave en Django 1.5</title><content type='html'>Hoy vamos a hacer algo para validar un campo en un &amp;nbsp;formulario, cuando le quitamos el foco al campo, este revisara en la base de datos, si ya existe, y no al final al hacer el submit. Esto es útil, para verificar si esta tomado el nombre de usuario, en caso de registro de usuarios, así como saber si el numero de identificación o cédula ya existe, entre otros.&lt;h3&gt;
Empecemos:&lt;/h3&gt;
&lt;div&gt;
primero creamos nuestra url en urls.py&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;url(regex=r&#39;^check_cedula/(?P&amp;lt;cedula&amp;gt;\d+)/$&#39;,&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;view=CedulaCheck.as_view(),&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;name=&#39;check_cedula&#39;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;),&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
Ahora nos vamos a nuestra vista views.py:&lt;/div&gt;
&lt;div&gt;
&lt;blockquote&gt;
class CedulaCheck(TemplateView):&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def dispatch(self, *args, **kwargs):&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;self.cedula = self.kwargs[&#39;cedula&#39;]&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return super(CedulaCheck, self).dispatch(*args, **kwargs)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def get(self, request, *args, **kwargs):&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if Persona.objects.filter(cedula__iexact=self.cedula):&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return HttpResponse(False)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;else:&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return HttpResponse(True)&lt;/blockquote&gt;
&lt;div&gt;
ya con esto podemos probar nuestra url con un numero de cédula y nos devolverá si existe o no&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
http://localhost:8000/check_cedula/12345678/&lt;/blockquote&gt;
Ahora nos vamos a poner en acción nuestra API &amp;nbsp;recién creada con un formulario, primero creamos nuestra clase en views.py:&lt;br /&gt;
&lt;blockquote&gt;
class PersonaCreateView(CreateView):&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;model = Persona&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;template_name = &#39;home/add_persona.html&#39;&lt;/blockquote&gt;
En nuestro html, nos vamos al campo que vamos a validar, es de notar que hice mi formulario a mano, no usando la plantilla de Django para crear los campos:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;label for=&quot;cedula&quot; class=&quot;control-label&quot;&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Cedula:&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/label&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;input name=&quot;cedula&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;cedula&quot;&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;span class=&quot;help-inline&quot; id=&quot;idval&quot;&amp;gt; &amp;nbsp;Escriba su Cedula de Identidad&amp;lt;/span&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/blockquote&gt;
y le agregamos el siguiente código jquery&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;function CheckId() {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$.get(&#39;/check_cedula/&#39;+escape($(&#39;#cedula&#39;).val())+&#39;/&#39;,&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;function(data){&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if(data == &quot;True&quot;){&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;$(&#39;#idval&#39;).html(&quot;&amp;lt;i class=&#39;icon-ok&#39;&amp;gt;&amp;lt;/i&amp;gt; Cedula disponible&quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;} else {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;$(&#39;#idval&#39;).html(&quot;&amp;lt;i class=&#39;icon-remove&#39;&amp;gt;&amp;lt;/i&amp;gt; Cedula existe&quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;});&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;function onChange(){&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$(&quot;#cedula&quot;).change( function() {CheckId()});&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$(document).ready(onChange);&lt;br /&gt;&amp;lt;/script&amp;gt;&amp;nbsp;&lt;/blockquote&gt;
&amp;nbsp;Y listo, cuando coloquemos una cédula que ya existe, al dejar el foco del campo, nos dará una advertencia que ya existe y así no tenemos que escribir todos los campos y darle submit para que nos de el error.&lt;br /&gt;
&lt;br /&gt;
Hasta la proxima</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/1538693138100968273/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/09/chequear-disponibilidad-de-campo-clave.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/1538693138100968273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/1538693138100968273'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/09/chequear-disponibilidad-de-campo-clave.html' title='Chequear disponibilidad de Campo Clave en Django 1.5'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-7291765579181423421</id><published>2013-09-15T18:08:00.000-07:00</published><updated>2014-07-24T18:28:55.156-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="django-1.5"/><category scheme="http://www.blogger.com/atom/ns#" term="flash"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jpegcam"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="webcam"/><title type='text'>Fotos con webcam usando Django 1.5 y JpegCam</title><content type='html'>Hola nuevamente&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Tenia un poco abandonado mi blog, debido a razones de trabajo, hoy vengo nuevamente a hablarles de Django, el framework de Python, esta vez, vamos a ver cosas interesantes como el tomar una instantánea o fotografía desde nuestra webcam utilizando una librería de Flash y Javascript.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Jpegcam es un interesante componente de Flash/JavaScript para capturar y guardar imágenes desde la webcam del usuario. Se puede utilizar por ejemplo para permitir a los usuarios hacer una imagen de sí mismos como avatares, o para completar su perfil.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Es un widget que a través de flash muestra una vista en vivo de la webcam y botones con funciones Javascript asociadas&amp;nbsp;&amp;nbsp;que puede capturar y enviar una imagen a un servidor en modo POST.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;¿Qué debemos hacer?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Descargar la ultima versión de &lt;a href=&quot;http://adf.ly/qYy49&quot; target=&quot;_blank&quot;&gt;Jpegcam&lt;/a&gt;&amp;nbsp;y agrégalo a tu carpeta de statics en tu proyecto Django, esta consta de archivos que son:&amp;nbsp;shutter.mp3, webcam.js, webcam.swf&lt;/li&gt;
&lt;li&gt;Editamos el archivo&amp;nbsp;&lt;b&gt;webcam.js&lt;/b&gt; y buscamos para configurar los path de&amp;nbsp;&lt;b&gt;swf_url&lt;/b&gt; y &lt;b&gt;shutter_url&lt;/b&gt;. En mi caso:&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; swf_url: &#39;/static/jpegcam/webcam.swf&#39;&lt;/b&gt;&lt;/i&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;shutter_url: &#39;/static/jpegcam/shutter.mp3&#39;&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;
&lt;div&gt;
&lt;i style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/i&gt;Y mas abajo en el archivo, aproximadamente en la linea 166, agregar el path:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.shutter_url = url ? url : &#39;/static/jpegcam/shutter.mp3&#39;;&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;
&lt;div&gt;
Ahora nos vamos a Django, quiero manifestar que esta guía esta hecha para personas que han programado con Django y tienen conocimientos básicos del framework.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Primero creamos nuestro modelo de datos, donde vamos a almacenar los datos de la persona a registrar y su fotografía.&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
models.py&lt;/blockquote&gt;
&lt;blockquote&gt;
from django.db import models&lt;br /&gt;
import os&lt;br /&gt;
def get_image_name(instance, filename):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;f, ext = os.path.splitext(filename)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;archivo = &#39;%s%s&#39; % (instance.cedula, ext)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return os.path.join(&#39;webcamimages&#39;, archivo)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
class Persona(models.Model):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;&quot;&quot;docstring for Personal&quot;&quot;&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cedula = models.CharField(max_length=10)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;nombres = models.CharField(max_length=60)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;apellidos = models.CharField(max_length=60)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;foto = models.ImageField(upload_to=get_image_name, blank=True, null=True)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def __unicode__(self):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return self.cedula&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@models.permalink&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def get_absolute_url(self):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return (&#39;persona&#39;, [str(self.id)])&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def _get_full_name(self):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&quot;Retorna los nombres completos de Persona&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &#39;%s %s&#39; % (self.nombres, self.apellidos)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;full_name = property(_get_full_name)&lt;/blockquote&gt;
Les explico un poco el modelo, primero tenemos una función llamada &lt;i&gt;get_image_name,&lt;/i&gt;&amp;nbsp;esta función nos sirve para llamar los archivos que subamos por la opción file del formulario, siempre tendrán el nombre del campo cedula con su extensión, si mi cédula es 12345 y estoy cargando el archivo foto.jpg, esta función lo renombrada y lo guardara como 12345.jpg en la carpeta webcamimages dentro de media.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;&lt;i&gt;foto = models.ImageField(upload_to=get_image_name, blank=True, null=True)&lt;/i&gt;&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
Ahora nos vamos a nuestro url.py, donde tenemos estas dos entradas:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;url(regex=r&#39;^persona/$&#39;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;view= PersonaCreateView.as_view(),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;name=&#39;add_persona&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;url(regex=r&#39;^save_image/(?P&amp;lt;cedula&amp;gt;\d+)/$&#39;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;view=SaveImage.as_view(),&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;name=&#39;salvar_imagen&#39;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; ),&lt;/blockquote&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
La que nos interesa en este momento es la de &lt;i&gt;save_image&lt;/i&gt;, ya que es la url que usaremos para tomar la fotografía, la otra es para que el formulario guarde la información dada.&lt;br /&gt;
&lt;br /&gt;
Ahora crearemos nuestro views.py&lt;br /&gt;
&lt;blockquote&gt;
from django.views.generic import TemplateView, CreateView, DetailView, ListView&lt;br /&gt;
from django.views.decorators.csrf import csrf_exempt&lt;br /&gt;
from django.http import HttpResponse&lt;br /&gt;
from django.conf import settings&lt;br /&gt;
from .models import Persona&lt;br /&gt;
&lt;br /&gt;
class SaveImage(TemplateView):&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@csrf_exempt&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def dispatch(self, *args, **kwargs):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;self.filename = self.kwargs[&#39;cedula&#39;]+&#39;.jpg&#39;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return super(SaveImage, self).dispatch(*args, **kwargs)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def post(self, request, *args, **kwargs):&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;# save it somewhere&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;f = open(settings.MEDIA_ROOT + &#39;/webcamimages/&#39;+ self.filename, &#39;wb&#39;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;f.write(request.body)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;f.close()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;# return the URL&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return HttpResponse(&quot;/media/webcamimages/&quot; + self.filename)&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def get(self, request, *args, **kwargs):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return HttpResponse(&#39;No esta pasando el POST&#39;)&lt;br /&gt;
&lt;br /&gt;
class PersonaCreateView(CreateView):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;model = Persona&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;template_name = &#39;home/add_persona.html&#39;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;def form_valid(self, form):&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;form.instance.foto = &#39;webcamimages/&#39;+ form.instance.cedula + &quot;.jpg&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return super(PersonaCreateView, self).form_valid(form)&lt;/blockquote&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
Como ven, tenemos dos clases, la primera &lt;i&gt;SaveImage&lt;/i&gt;, que es la que nos toma la instantánea y la guarda en la carpeta &lt;i&gt;webcamimages&lt;/i&gt; con la cédula de la persona, la otra es la que guarda en base de datos y toma la dirección donde esta guardada la imagen y la agrega en el campo foto.&lt;br /&gt;
&lt;br /&gt;
Ahora hacemos el html, llamado en nuestro caso add_persona.html&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
{% extends &quot;base.html&quot; %}&lt;br /&gt;
{% block extra_css %}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;!-- Primero, incluir la libreria de JpegCam --&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;{{ STATIC_URL }}jpegcam/webcam.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
{% endblock extra_css %}&lt;br /&gt;
{% block contenido %}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;h1&amp;gt;Registrar Persona&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;form class=&quot;span10&quot; action=&quot;&quot; method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{% csrf_token %}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;row well&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;span6&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;label for=&quot;cedula&quot; class=&quot;control-label&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;Cedula:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/label&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;input name=&quot;cedula&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;cedula&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;span class=&quot;help-inline&quot;&amp;gt; &amp;nbsp;Escriba su Cedula de Identidad&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;label for=&quot;nombres&quot; class=&quot;control-label&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;Nombres:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/label&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;input name=&quot;nombres&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;nombres&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;label for=&quot;apellidos&quot; class=&quot;control-label&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;Apellidos:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/label&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;input name=&quot;apellidos&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;apellidos&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;label for=&quot;foto&quot; class=&quot;control-label&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;Foto:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/label&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;input name=&quot;foto&quot; type=&quot;file&quot; value=&quot;&quot; id=&quot;foto&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;a href=&quot;#takephoto&quot; role=&quot;button&quot; data-toggle=&quot;modal&quot; class=&quot;btn btn-warning&quot;&amp;gt;Tomar Foto&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;span3&quot; id=&quot;fotoview&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary pull-right&quot;&amp;gt;Guardar&amp;lt;/button&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;!-- Advanced Modal --&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;div id=&quot;takephoto&quot; class=&quot;modal hide fade&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot; aria-labelledby=&quot;myModalLabel&quot; aria-hidden=&quot;true&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;modal-header&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot; aria-hidden=&quot;true&quot;&amp;gt;×&amp;lt;/button&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;lt;h3 id=&quot;myModalLabel&quot;&amp;gt;Camara&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;modal-body&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;!-- Configure a few settings --&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;script language=&quot;JavaScript&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;document.write( webcam.get_html(320, 240) );&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;modal-footer&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;button class=&quot;btn&quot; data-dismiss=&quot;modal&quot; aria-hidden=&quot;true&quot;&amp;gt;Cerrar&amp;lt;/button&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;button class=&quot;btn btn-primary&quot; onClick=&quot;take_snapshot()&quot; &amp;gt;Fotografíar&amp;lt;/button&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
{% endblock contenido %}&lt;/blockquote&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
Lo primero es cargar la librería jpegcam.js, luego creamos nuestro formulario, aquí estoy usando bootstrap para ayudarme con los estilos, utilizo una ventana modal para activar la cámara y tomar la fotografía. Aquí algunos captura de pantalla de la aplicación final:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhutzN5QM3a1RswffbMl74TeLqm2fsy57WkcpGt7_PTa9IbRUaY85_vz-5A7DxWFfxIcShPzTcu_w6W7OUelB55A0MgWMig6tfiIbGupLKX5AHhHu06v_R94VMxVnzfOAT4cyv1l2M2c1c/s1600/pantalla1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhutzN5QM3a1RswffbMl74TeLqm2fsy57WkcpGt7_PTa9IbRUaY85_vz-5A7DxWFfxIcShPzTcu_w6W7OUelB55A0MgWMig6tfiIbGupLKX5AHhHu06v_R94VMxVnzfOAT4cyv1l2M2c1c/s640/pantalla1.png&quot; height=&quot;296&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-dceTTdLD4G-junUtPKxrYFkAOkL9iwymQvCuxzQznEwgg5lOMLDvvQTfS2pH-B-jTMyFNiejT2hfj18xGKhYj-MbP9sX07YAeKaSXJZFGGuvcQAmZQtjFfka4VppcjQ7lim7P77fgXI/s1600/modal.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-dceTTdLD4G-junUtPKxrYFkAOkL9iwymQvCuxzQznEwgg5lOMLDvvQTfS2pH-B-jTMyFNiejT2hfj18xGKhYj-MbP9sX07YAeKaSXJZFGGuvcQAmZQtjFfka4VppcjQ7lim7P77fgXI/s640/modal.png&quot; height=&quot;336&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Y listo, quiero manifestar que hay formas de utilizar la cámara sin usar flash, el cual esta muy cuestionado por el tema de seguridad, mas esto les puede servir en un entorno empresarial, esta aplicación la pueden descargar desde github es este &lt;a href=&quot;http://adf.ly/qYy7J&quot; target=&quot;_blank&quot;&gt;enlace&lt;/a&gt;, Espero sus recomendaciones y mejoras.&lt;br /&gt;
&lt;br /&gt;
Saludos&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/7291765579181423421/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/09/fotos-con-webcam-usando-django-15-y.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/7291765579181423421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/7291765579181423421'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2013/09/fotos-con-webcam-usando-django-15-y.html' title='Fotos con webcam usando Django 1.5 y JpegCam'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhutzN5QM3a1RswffbMl74TeLqm2fsy57WkcpGt7_PTa9IbRUaY85_vz-5A7DxWFfxIcShPzTcu_w6W7OUelB55A0MgWMig6tfiIbGupLKX5AHhHu06v_R94VMxVnzfOAT4cyv1l2M2c1c/s72-c/pantalla1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-482162179102260336</id><published>2012-12-25T15:09:00.000-08:00</published><updated>2012-12-25T15:09:32.704-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="galaxy"/><category scheme="http://www.blogger.com/atom/ns#" term="Jelly Bean"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="nexus"/><category scheme="http://www.blogger.com/atom/ns#" term="samsung"/><title type='text'>Actualizando el Samsung Galaxy Nexus a Jelly Bean 4.2.1 desde Linux</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Hola,&amp;nbsp;aquí&amp;nbsp;estoy con un nuevo tema, el cual&amp;nbsp;surgió&amp;nbsp;de la necesidad de actualizar mi&amp;nbsp;teléfono&amp;nbsp;Samsung Galaxy Nexus GT-i9250, cansado de esperar la actualización&amp;nbsp;automatica&amp;nbsp;por parte de Google,&amp;nbsp;así&amp;nbsp;que me puse a curiosear un poco por la red y&amp;nbsp;conseguí&amp;nbsp;que se&amp;nbsp;podía&amp;nbsp;hacer, pero mis exigencias eran un poco mas&amp;nbsp;allá&amp;nbsp;de lo que normalmente&amp;nbsp;conseguía, aplicaciones hechas solo en Windows.&amp;nbsp;Quería&amp;nbsp;que funcionaran en linux y logre conseguir a&lt;b&gt;&amp;nbsp;Universal Nexus Linux Toolkit v2.0&lt;/b&gt;, que es&amp;nbsp;un programa basado en script bash que ofrece una manera fácil de hacer todo lo que necesita hacer antes de flashear una ROM personalizada en el dispositivo Nexus.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Eso es lo que yo necesitaba y me arriesgue a usarlo,&amp;nbsp;aquí&amp;nbsp;les voy a contar lo sencillo que es, sin complicaciones. Eso si, te recomiendo que hagas tu respaldo, ya que este procedimiento te deja el&amp;nbsp;teléfono&amp;nbsp;como viene de fabrica.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Este programa sirve para los siguientes equipos:&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Nexus 4 [mako]&lt;/li&gt;
&lt;li&gt;Nexus 10 [manta]&lt;/li&gt;
&lt;li&gt;Nexus 7 (WiFi) [grouper]&lt;/li&gt;
&lt;li&gt;Galaxy Nexus (GSM) [maguro]&lt;/li&gt;
&lt;li&gt;Galaxy Nexus (Verizon) [toro]&lt;/li&gt;
&lt;li&gt;Galaxy Nexus (Sprint) [toroplus]&lt;/li&gt;
&lt;li&gt;Nexus S (worldwide version, i9020t and i9023) [crespo]&lt;/li&gt;
&lt;li&gt;Nexus S (850MHz version, i9020a) [crespo]&lt;/li&gt;
&lt;li&gt;Nexus S (Korea version, m200) [crespo]&lt;/li&gt;
&lt;li&gt;Nexus S 4G (d720) [crespo4g]&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div&gt;
En mi caso, por mi modelo voy a usar la numero 4,&amp;nbsp;Galaxy Nexus (GSM) [maguro]&lt;/div&gt;
&lt;div&gt;
Con esta herramienta usted será capaz de:&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Unlock the bootloader. (Desbloquear el gestor de arranque)&lt;/li&gt;
&lt;li&gt;Flash CWM recovery (Standard or Touch).&lt;/li&gt;
&lt;li&gt;Root the phone. (poner en root el telefono)&lt;/li&gt;
&lt;li&gt;Lock the bootloader. (Bloquear el gestor de arranque)&lt;/li&gt;
&lt;li&gt;Flash Google Factory Image. (Instalar Imagen de Fabrica de Google)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;b&gt;Empecemos:&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Como les dije lo primero es estar seguro que tienes tu respaldo al&amp;nbsp;día&amp;nbsp;de tu&amp;nbsp;teléfono&amp;nbsp;asociado con tu cuenta de gmail, es muy sencillo solo entra en la&amp;nbsp;configuración&amp;nbsp;de tu&amp;nbsp;teléfono&amp;nbsp;en la&amp;nbsp;opción&amp;nbsp;&lt;i&gt;copia de seguridad y restablecer &lt;/i&gt;y asegura que tengas tildado la&amp;nbsp;opción&amp;nbsp;de &quot;Hacer una copia de seguridad&quot;, que tu cuenta de gmail sea la correcta y la&amp;nbsp;opción&amp;nbsp;de &quot;Restaurar&amp;nbsp;automáticamente&quot;. Esto te asegura que al asociar tu&amp;nbsp;teléfono&amp;nbsp;a tu cuenta de gmail, el bajara todas tus aplicaciones y contactos que tenias en la&amp;nbsp;versión&amp;nbsp;anterior. esto&amp;nbsp;también&amp;nbsp;es&amp;nbsp;útil&amp;nbsp;cuando cambias de&amp;nbsp;teléfono, por supuesto debe ser otro android.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVKDkYAPa8DpjkGuRWiUDHm3JYHcDqRbWhPnXXA-9XZZXgS2HplbPPVXoR2B3OAMVNDURmF7sNmLnz4V6IgoRhMIcm6e1imi3FcJZ3vRQlifO_ldNTzpt1Dc9e73Vhl2kVuYVIPSYHHEg/s1600/2012-12-25+15.05.06.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVKDkYAPa8DpjkGuRWiUDHm3JYHcDqRbWhPnXXA-9XZZXgS2HplbPPVXoR2B3OAMVNDURmF7sNmLnz4V6IgoRhMIcm6e1imi3FcJZ3vRQlifO_ldNTzpt1Dc9e73Vhl2kVuYVIPSYHHEg/s400/2012-12-25+15.05.06.png&quot; width=&quot;225&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
¿Que necesitamos?&lt;/h3&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, primero quiero aclarar que yo uso Ubuntu, por lo tanto no lo he probado en otra distribución, pero al ser un shell script no creo que tengan problemas, cualquier cosa revisen la pagina del&amp;nbsp;&lt;a href=&quot;http://code.google.com/p/galaxy-nexus-linux-toolkit/&quot; rel=&quot;nofollow&quot;&gt;desarrollador&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Nota:&lt;/b&gt;&amp;nbsp; Si estas corriendo linux en 64 bits, debes instalar las&amp;nbsp;librerías&amp;nbsp;de 32 bits&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
1.- bajar el shell script desde &lt;a href=&quot;http://code.google.com/p/galaxy-nexus-linux-toolkit/downloads/detail?name=unlt202.tgz&amp;amp;can=2&amp;amp;q=&quot; rel=&quot;nofollow&quot;&gt;aqui&lt;/a&gt;&lt;br /&gt;2.- Extrae el archivo .tgz donde tu quieras, te recomiendo que sea dentro de tu carpeta home, en mi caso &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /home/fquivera&lt;/b&gt;&lt;br /&gt;3.- Abre un terminal y escribe lo siguiente:&lt;br /&gt;Primero nos dirigimos a la carpeta donde esta el shell script, en mi caso:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;b&gt;cd /home/fquivera/unlt&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Hay que hacer una&amp;nbsp;corrección&amp;nbsp;en los enlaces dentro del shell script, ya que Google, borro las&amp;nbsp;imágenes&amp;nbsp;anteriores de la&amp;nbsp;versión&amp;nbsp;4.2 por errores,&amp;nbsp;&amp;nbsp;para esto editamos el archivo unlt.sh.&lt;br /&gt;Podemos utilizar cualquier editor, en la linea numero 156 y 157, cambiar estas lineas por:&lt;br /&gt;&lt;span style=&quot;background-color: #cccccc;&quot;&gt;FACTORY_MAGURO=&quot;https://dl.google.com/dl/android/aosp/takju-jop40d-factory-e4d13f14.tgz&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;MD5_MAGURO=&quot;351926836d314848ed4292bbc499ff36&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Cualquier cosa puedes revisar estos enlaces en la pagina de desarrolladores de Google &lt;a href=&quot;https://developers.google.com/android/nexus/images&quot; rel=&quot;nofollow&quot;&gt;aqui&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
4.- En cuanto tu&amp;nbsp;teléfono&amp;nbsp;debes colocarlo en modo USB Depuración, Para activar la depuración USB en el teléfono: desde configuración -&amp;gt; opciones de desarrollo, marcamos la casilla depuración USB. &lt;a href=&quot;http://www.youtube.com/watch?v=i1jxf9Bzvmo&quot; rel=&quot;nofollow&quot;&gt;Aqui&lt;/a&gt; te doy un enlace de un video de como hacerlo.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
5.- Conectamos el&amp;nbsp;teléfono via USB.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
6.- Ahora ejecutamos el shell script&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;sudo bash ./unlt.sh&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; se utiliza sudo, porque debe ser utilizado con privilegios de administrador&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLGB7SoyabeTNcATICUhruAC7L4lFCG02XCLCPBmbqrmQfY1TDSNUdnCKwOTpGi-gkDQs1I0tUUhUULidksB-S5btoyi9eIAv86rixXa1cQXMG6yAMRp5FUY2MlmYhHbaW3t279o5Mj3w/s1600/start_unlt.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;115&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLGB7SoyabeTNcATICUhruAC7L4lFCG02XCLCPBmbqrmQfY1TDSNUdnCKwOTpGi-gkDQs1I0tUUhUULidksB-S5btoyi9eIAv86rixXa1cQXMG6yAMRp5FUY2MlmYhHbaW3t279o5Mj3w/s640/start_unlt.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
7.- Escojamos&amp;nbsp;la&amp;nbsp;opción&amp;nbsp;de nuestro&amp;nbsp;teléfono (En mi caso la opción 4):&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFrB-ZfMOhw8NOz_nsbq0SMjK-uWEC4q03A2aTP3GbOatfDP-Z7qIDK_4FlWdzrVJmS93BVxdb1e3LWDdGsdpRW5QSkvFB_1yPOVQaQ35jOUI7lsK4mpkmuirMMs_g6V4bgY9P4RhIjFI/s1600/escojer_unlt.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;348&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFrB-ZfMOhw8NOz_nsbq0SMjK-uWEC4q03A2aTP3GbOatfDP-Z7qIDK_4FlWdzrVJmS93BVxdb1e3LWDdGsdpRW5QSkvFB_1yPOVQaQ35jOUI7lsK4mpkmuirMMs_g6V4bgY9P4RhIjFI/s640/escojer_unlt.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
8.- Ahora nos&amp;nbsp;pedirá&amp;nbsp;si queremos hacerlo en&amp;nbsp;Automático&amp;nbsp;(Recomendado) o Manual.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMPiFogwASXc_hVFfBVX_xhhvXniXKxEEudHJinMBRZQc4HTJiXwnhAfuO0Y6TD89SiTnkUtIQM3D0G-Cg5cDHAFWFOA_cCbowlpYb05FGWix-ymGifB6WYcKA3eq7BoQFpRwQktsgKtI/s1600/modo_unlt.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMPiFogwASXc_hVFfBVX_xhhvXniXKxEEudHJinMBRZQc4HTJiXwnhAfuO0Y6TD89SiTnkUtIQM3D0G-Cg5cDHAFWFOA_cCbowlpYb05FGWix-ymGifB6WYcKA3eq7BoQFpRwQktsgKtI/s640/modo_unlt.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
9.- Ahora nos muestra la pantalla de las acciones que podemos hacer en nuestro dispositivo, en nuestro caso vamos ir por la opción 5&amp;nbsp;&amp;nbsp;Flash Google Factory Image&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl9tV7uYOXEKZmfPM025xgS4h3wbBb1nL3OPdzqwnyZ8Oi_p2rM7DCWq0-O62mI3bVBu6lNafP98yZFi2gIghDEU59Jh7XoXPwdKI6lyo6qzIUwF2Rm7YpWNwyX44p5pRfz3qOrk8Sw4o/s1600/accion_unlt.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;284&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl9tV7uYOXEKZmfPM025xgS4h3wbBb1nL3OPdzqwnyZ8Oi_p2rM7DCWq0-O62mI3bVBu6lNafP98yZFi2gIghDEU59Jh7XoXPwdKI6lyo6qzIUwF2Rm7YpWNwyX44p5pRfz3qOrk8Sw4o/s640/accion_unlt.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
10.- Ahora nos pide que tengamos nuestro&amp;nbsp;teléfono&amp;nbsp;encendido y conectado en modo USB Depuración y se procede a empezar el proceso&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjijfrtbMpmwEjejAt4I0ME25K-I8UZkuLluCE_Ff-Gmbt82XFiJuM49XgY2ZpBNGj1JfkMkR0LU_gDXm-rLUEt7rKwo3JNnPdCDnpk5ppk0RaBn7D_1pfRjv8G0VlvzZ4uHFJHTz542aU/s1600/fgfi_unlt.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;234&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjijfrtbMpmwEjejAt4I0ME25K-I8UZkuLluCE_Ff-Gmbt82XFiJuM49XgY2ZpBNGj1JfkMkR0LU_gDXm-rLUEt7rKwo3JNnPdCDnpk5ppk0RaBn7D_1pfRjv8G0VlvzZ4uHFJHTz542aU/s640/fgfi_unlt.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
11.- &amp;nbsp;Aquí&amp;nbsp;ira a Google developers a descargar la imagen, un error que puede&amp;nbsp;ocurrir&amp;nbsp;es que no tengan instalado en su linux el wget, que es el comando que utiliza para ello. en Ubuntu, lo instalas con:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;b&gt;sudo apt-get install wget&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Luego de descargar la imagen, comienza a cargar la imagen al Nexus, va&amp;nbsp;parpadear&amp;nbsp;varias veces su&amp;nbsp;teléfono&amp;nbsp;y ustedes&amp;nbsp;podrán&amp;nbsp;ver por el terminal del PC, lo que esta pasando. Al terminar reiniciara el&amp;nbsp;teléfono&amp;nbsp;y lo dejara tal como viene de fabrica, para que comiences a&amp;nbsp;configurar&amp;nbsp;con tu cuenta y baje&amp;nbsp;automáticamente&amp;nbsp;tus aplicaciones y contactos.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Como conclusión les comento que mi&amp;nbsp;teléfono&amp;nbsp;funciona excelente con Jelly Bean 4.2.1 y actualizo todas mis aplicaciones.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj52MXFCPavXE0rW2lFitma5P3W4wR-YkFXWikK0J0nK6SjIGorhupQ7zVT-xA60kOc2xPIEbef0rjArZoClIJOLzdc5TzdMzsBwzq1d9exdZf8T3-qUc_JiA-nHav4T5vxsdEUUfDk9_Y/s1600/2012-12-25+18.31.51.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj52MXFCPavXE0rW2lFitma5P3W4wR-YkFXWikK0J0nK6SjIGorhupQ7zVT-xA60kOc2xPIEbef0rjArZoClIJOLzdc5TzdMzsBwzq1d9exdZf8T3-qUc_JiA-nHav4T5vxsdEUUfDk9_Y/s400/2012-12-25+18.31.51.png&quot; width=&quot;225&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Esta no es la&amp;nbsp;única&amp;nbsp;forma de actualizar tu&amp;nbsp;Galaxy Nexus&amp;nbsp; hay varias que puedes ver en Youtube o en Google, espero que este post les ayude y no olviden dejar sus comentarios al respecto. Saludos&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Referencias:&lt;/h3&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
galaxy-nexus-linux-toolkit -&amp;nbsp;&lt;a href=&quot;http://code.google.com/p/galaxy-nexus-linux-toolkit/&quot;&gt;http://code.google.com/p/galaxy-nexus-linux-toolkit/&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
xda-developers -&amp;nbsp;&lt;a href=&quot;http://forum.xda-developers.com/showthread.php?t=1810119&quot;&gt;http://forum.xda-developers.com/showthread.php?t=1810119&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/482162179102260336/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2012/12/actualizando-el-samsung-galaxy-nexus.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/482162179102260336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/482162179102260336'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2012/12/actualizando-el-samsung-galaxy-nexus.html' title='Actualizando el Samsung Galaxy Nexus a Jelly Bean 4.2.1 desde Linux'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVKDkYAPa8DpjkGuRWiUDHm3JYHcDqRbWhPnXXA-9XZZXgS2HplbPPVXoR2B3OAMVNDURmF7sNmLnz4V6IgoRhMIcm6e1imi3FcJZ3vRQlifO_ldNTzpt1Dc9e73Vhl2kVuYVIPSYHHEg/s72-c/2012-12-25+15.05.06.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-5997485014382749939</id><published>2012-10-10T12:23:00.000-07:00</published><updated>2012-10-10T12:23:23.083-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="django-1.4"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="programación"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Creando Aplicaciones Web con Django 1.4 (2da Parte)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
En el articulo &lt;a href=&quot;http://laempresaconsoftwareabierto.blogspot.com/2012/09/creando-aplicaciones-web-con-django-14.html&quot; target=&quot;_blank&quot;&gt;anterior&lt;/a&gt; hablamos de como arrancar un proyecto en Django, en esta oportunidad aprenderemos un tema importante como es la configuración&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;del
 proyecto. podemos decir primeramente que no 
hay una manera definitiva de hacerla, ya que la flexibilidad de 
Django nos permite que cada quien la realice a sus gusto.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Django por ser un framework de Python, utiliza este lenguaje para guardar sus configuraciones y aprovecha la
 manera de trabajar del lenguaje para hacer archivos de configuración 
fáciles de leer, extender y utilizar dentro de nuestros proyectos. Por eso es que quizás veremos en algunos proyectos que la configuración esta en varios archivos Python. En nuestro caso solo hablaremos y trabajaremos con el archivo&lt;b&gt; &lt;i&gt;settings.py.&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Empecemos:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Editamos nuestro archivo &lt;i&gt;&lt;b&gt;settings.py&lt;/b&gt;&lt;/i&gt; con nuestro editor preferido, en mi caso yo uso &lt;a href=&quot;http://www.vim.org/&quot; target=&quot;_blank&quot;&gt;vim&lt;/a&gt;, pero también lo puedes hacerlo con gedit, &lt;a href=&quot;http://www.geany.org/&quot; target=&quot;_blank&quot;&gt;geany&lt;/a&gt; o &lt;a href=&quot;http://www.nano-editor.org/&quot; target=&quot;_blank&quot;&gt;nano&lt;/a&gt; (que es un clon del antiguo Wordstar, para algunos nostálgicos).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Primeramente importamos &lt;i&gt;&lt;b&gt;os&lt;/b&gt;&lt;/i&gt;, este módulo&lt;tt&gt; &lt;/tt&gt;&lt;tt class=&quot;xref py py-mod docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&lt;/span&gt;&lt;/tt&gt;provee docenas de funciones para interactuar
con el sistema operativo, en nuestro caso lo usaremos para conocer la ruta de nuestro proyecto.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;# -*- coding: UTF-8 -*-&lt;br /&gt;# Django settings for recetas project.&lt;br /&gt;&lt;br /&gt;import os&lt;br /&gt;&lt;br /&gt;#Definimos la ruta del proyecto&lt;br /&gt;RUTA_PROYECTO = os.path.dirname(os.path.realpath(__file__))&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
También le damos la codificación UTF-8 a nuestro archivo de configuración para evitar los errores de caracteres en nuestro idioma.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Django por defecto trae la opción &lt;i&gt;&lt;b&gt;DEBUG=True&lt;/b&gt;&lt;/i&gt;, para que mientras estemos en desarrollo, podamos ver en detalle los errores de la aplicación, en le caso que tengamos la opción de &lt;i&gt;&lt;b&gt;DEBUG=False&lt;/b&gt;&lt;/i&gt;, normalmente en producción, las notificaciones de 
error de código son enviadas vía correo electrónico a los 
administradores, junto con los detalles completos del error. Para poner los datos de los administradores, debemos agregar en forma de tupla, en mi caso lo dejaré así:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&lt;i&gt;&lt;b&gt;ADMINS = (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&#39;Francisco Quivera&#39;, &#39;fquivera@gmail.com&#39;),&lt;br /&gt;)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Una vez hecho esto vamos a definir con que manejador de base de datos trabajara nuestro proyecto. Quiero aclarar que aunque es posible usar Django sin una base de datos, Django incluye un mapeador objeto-relacional (ORM), en el que es posible describir la estructura 
de la base de datos usando Python. Esto lo veremos en mas detalle cuando veamos los modelos, aquí solo le diremos a Django con que manejador de base de datos vamos a trabajar. Django soporta de manera predeterminada la conexión con Postgresql, MySql, Sqlite3 y Oracle. En nuestro proyecto usaremos Sqlite3, por su facilidad de uso, ya que viene con Python desde la versión 2.5.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Busquemos la siguiente sección del archivo y modificamos:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;DATABASES = {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;default&#39;: {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;ENGINE&#39;: &#39;&lt;span style=&quot;background-color: yellow;&quot;&gt;django.db.backends.sqlite3&lt;/span&gt;&#39;, #Add &#39;postgresql_psycopg2&#39;, &#39;mysql&#39;, &#39;sqlite3&#39; or &#39;oracle&#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;NAME&#39;: &lt;span style=&quot;background-color: yellow;&quot;&gt;os.path.join(RUTA_PROYECTO,&#39;db/recetas.db&#39;)&lt;/span&gt;, # Or path to database file if using sqlite3.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;USER&#39;: &#39;&#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Not used with sqlite3.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;PASSWORD&#39;: &#39;&#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Not used with sqlite3.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;HOST&#39;: &#39;&#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set to empty string for localhost. Not used with sqlite3.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;PORT&#39;: &#39;&#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set to empty string for default. Not used with sqlite3.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Estoy resaltando lo que vamos a agregar, en el caso de utilizar MySql o Postgres, deben instalar previamente los módulos Python para la conexión con estas bases de datos, en Ubuntu se hace con:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;MySql:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;&lt;span class=&quot;st&quot;&gt;&lt;em&gt;sudo install python&lt;/em&gt;-&lt;em&gt;mysqldb&lt;/em&gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Postgres:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;i&gt;&lt;b&gt;sudo apt-get install python-psycopg2&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Configurar la zona horaria, Django permite configurar la zona horaria del proyecto, esto lo hacemos en la siguiente sección, en mi caso agregue la que me corresponde, pueden buscar en la red cual es la que aplica para su caso:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;TIME_ZONE = &#39;America/Caracas&#39;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Django también permite configurar el idioma que usará de manera 
predeterminada para su funcionamiento, esto es muy útil ya que el administrador de Django, utilizara el idioma definido aquí, para configurar esto debemos cambiar lo siguiente:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;LANGUAGE_CODE = &#39;es-VE&#39;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Django requiere rutas de archivos para cargar archivos estáticos y 
definir donde estarán nuestras Plantillas o Templates, para hacer esto de manera 
dinámica, usamos las bondades que nos ofrece Python. Como ya definimos la variable RUTA_PROYECTO, que no es mas que la ruta del 
directorio donde se encuentra dicho archivo, a partir de éste armaremos la ruta de los archivos estáticos.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para esto primero debemos crear las carpetas donde vamos a tener dichos archivos, como ya estamos ubicados en &lt;i&gt;&lt;b&gt;home/fquivera/recetas/recetas,&lt;/b&gt;&lt;/i&gt; hacemos lo siguiente:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;mkdir static media plantillas db&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
luego nos cambiamos a static para crear otras carpetas&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;cd static&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;mkdir js img css fonts&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Nos deba quedar nuestro árbol de directorio de la siguiente manera:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;└── recetas&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── manage.py&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; └── recetas&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── __init__.py&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── db&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── media&lt;/b&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── plantillas&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── settings.py&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── static&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; │&amp;nbsp;&amp;nbsp; ├── css&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; │&amp;nbsp;&amp;nbsp; ├── fonts&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; │&amp;nbsp;&amp;nbsp; ├── img&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; │&amp;nbsp;&amp;nbsp; └── js&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ├── urls.py&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; └── wsgi.py&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;¿Para que son esas carpetas que acabamos de crear?&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, la carpeta &lt;i&gt;&lt;b&gt;static&lt;/b&gt;&lt;/i&gt; la utilizamos para ubicar los archivos de estilos css, dentro de la carpeta &lt;i&gt;&lt;b&gt;css&lt;/b&gt;&lt;/i&gt;, los javascript que podamos utilizar dentro de la carpeta&lt;i&gt;&lt;b&gt; js,&lt;/b&gt;&lt;/i&gt; las imágenes de nuestro proyecto, como logos, backgrounds, entre otros en la carpeta &lt;i&gt;&lt;b&gt;img &lt;/b&gt;&lt;/i&gt;y por ultimo si requerimos alguna fuente de letra, la ubicamos en la carpeta&lt;i&gt;&lt;b&gt; fonts&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Por otro lado esta la carpeta &lt;i&gt;&lt;b&gt;media&lt;/b&gt;&lt;/i&gt;, esta carpeta la usamos para almacenar las imágenes, videos, sonidos que utilizamos en nuestros datos, osea, multimedia asociada en nuestra base de datos.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y por ultimo la carpeta &lt;i&gt;&lt;b&gt;plantillas&lt;/b&gt;&lt;/i&gt; que allí estarán nuestras plantillas html de nuestro proyecto. La carpeta &lt;i&gt;&lt;b&gt;db&lt;/b&gt;&lt;/i&gt; es para el archivo de base de datos Sqlite3.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora nos toca decirle a Django a través del archivo &lt;i&gt;&lt;b&gt;settings.py&lt;/b&gt;&lt;/i&gt; donde están ubicados esos archivos, para ello volvemos a editarlo, buscamos y cambiamos lo siguiente:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Esta variable le dirá a Django donde esta ubicada la carpeta media&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;MEDIA_ROOT = os.path.join(RUTA_PROYECTO,&#39;media&#39;)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
La siguiente es la ubicación vía URL, nos permitirá ubicarla mediante http://miproyecto/media&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;MEDIA_URL = &#39;/media/&#39;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Igualmente la URL para los archivos estáticos&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;STATIC_URL = &#39;/static/&#39;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
La ubicación de los archivos estáticos:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;STATICFILES_DIRS = (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.path.join(RUTA_PROYECTO,&#39;static&#39;),&lt;br /&gt;)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Por ultimo, la ubicación de mis plantillas&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;TEMPLATE_DIRS = (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.path.join(RUTA_PROYECTO,&#39;plantillas&#39;),&lt;br /&gt;)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Los proyectos en Django trabajan con aplicaciones, algunas ya vienen 
configuradas de manera predeterminada. Primeramente vamos a utilizar la 
aplicación de administración y su documentación, estas ya vienen 
construidas. Para habilitar estas aplicaciones debemos buscar la sección de &lt;i&gt;&lt;b&gt;INSTALLED_APPS&lt;/b&gt;&lt;/i&gt; que se encuentra casi al final del archivo &lt;i&gt;&lt;strong&gt;settings.py &lt;/strong&gt;&lt;/i&gt;y quitarle la marca de comentarios a &lt;i&gt;&lt;b&gt;&#39;django.contrib.admin&#39;&lt;/b&gt;&lt;/i&gt; y &lt;i&gt;&lt;b&gt;&#39;django.contrib.admindocs&#39;&lt;/b&gt;&lt;/i&gt;. Nos debe quedar de la siguiente manera:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;i&gt;&lt;b&gt;INSTALLED_APPS = (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.auth&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.contenttypes&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.sessions&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.sites&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.messages&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.staticfiles&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.flatpages&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.admin&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;django.contrib.admindocs&#39;,&lt;br /&gt;)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora salvamos nuestro archivo &lt;i&gt;&lt;b&gt;settings.py,&lt;/b&gt;&lt;/i&gt; regresamos a la carpeta principal y ejecutamos el siguiente comando:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;python manage.py syncdb&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Este comando nos crea la base de datos del proyecto, hasta ahora solo va generar las tablas necesarias por el administrador de Django.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;Creating tables ...&lt;br /&gt;Creating table auth_permission&lt;br /&gt;Creating table auth_group_permissions&lt;br /&gt;Creating table auth_group&lt;br /&gt;Creating table auth_user_user_permissions&lt;br /&gt;Creating table auth_user_groups&lt;br /&gt;Creating table auth_user&lt;br /&gt;Creating table django_content_type&lt;br /&gt;Creating table django_session&lt;br /&gt;Creating table django_site&lt;br /&gt;Creating table django_admin_log&lt;br /&gt;&lt;br /&gt;You just installed Django&#39;s auth system, which means you don&#39;t have any superusers defined.&lt;br /&gt;Would you like to create one now? (yes/no): &lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Aquí nos pide si queremos crear el superusuario para el administrador, le decimos que si, y nos pide los datos del usuario que sera el administrador&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;Would you like to create one now? (yes/no): yes&lt;br /&gt;Username (leave blank to use &#39;fquivera&#39;): &lt;br /&gt;E-mail address: fquivera@gmail.com&lt;br /&gt;Password: &lt;br /&gt;Password (again): &lt;br /&gt;Superuser created successfully.&lt;br /&gt;Installing custom SQL ...&lt;br /&gt;Installing indexes ...&lt;br /&gt;Installed 0 object(s) from 0 fixture(s)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora para poder ver los cambios que hicimos y navegar por la interfaz 
administrativa de Django, aún falta modificar un archivo llamado &lt;i&gt;&lt;b&gt;
urls.py&lt;/b&gt;&lt;/i&gt;. Este archivo esta en la misma carpeta donde esta el archivo &lt;i&gt;&lt;b&gt;settings.py&lt;/b&gt;&lt;/i&gt;. Modifiquemos este archivo:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;vim urls.py&lt;/b&gt;&lt;/i&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;from django.conf.urls import patterns, include, url&lt;br /&gt;&lt;br /&gt;# Uncomment the next two lines to enable the admin:&lt;br /&gt;# from django.contrib import admin&lt;br /&gt;# admin.autodiscover()&lt;br /&gt;&lt;br /&gt;urlpatterns = patterns(&#39;&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Examples:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # url(r&#39;^$&#39;, &#39;recetas.views.home&#39;, name=&#39;home&#39;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # url(r&#39;^recetas/&#39;, include(&#39;recetas.foo.urls&#39;)),&lt;br /&gt;&lt;br /&gt;&amp;nbsp; #Uncomment the admin/doc line below to enable admin documentation:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # url(r&#39;^admin/doc/&#39;, include(&#39;django.contrib.admindocs.urls&#39;)),&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Uncomment the next line to enable the admin:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # url(r&#39;^admin/&#39;, include(admin.site.urls)),&lt;br /&gt;)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Quitemos el comentario a algunas cosas y nos queda el archivo de la siguiente manera:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;from django.conf.urls import patterns, include, url&lt;br /&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;from django.contrib import admin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;admin.autodiscover()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;urlpatterns = patterns(&#39;&#39;,&lt;/b&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Examples:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # url(r&#39;^$&#39;, &#39;recetas.views.home&#39;, name=&#39;home&#39;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # url(r&#39;^recetas/&#39;, include(&#39;recetas.foo.urls&#39;)),&lt;/b&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: yellow;&quot;&gt; url(r&#39;^admin/doc/&#39;, include(&#39;django.contrib.admindocs.urls&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;background-color: yellow;&quot;&gt;url(r&#39;^admin/&#39;, include(admin.site.urls)),&lt;/span&gt;&lt;br /&gt;)&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
he resaltado lo que he cambiado, además se han borrado las lineas de comentario, bien ahora si probamos lo que hemos hecho hasta ahora&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;$ python manage.py runserver&lt;br /&gt;Validating models...&lt;br /&gt;&lt;br /&gt;0 errors found&lt;br /&gt;Django version 1.4.1, using settings &#39;recetas.settings&#39;&lt;br /&gt;Development server is running at http://127.0.0.1:8000/&lt;br /&gt;Quit the server with CONTROL-C.&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y probamos en nuestro navegador &lt;i&gt;&lt;b&gt;http://127.0.0.1:8000&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
veremos lo siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVLFix9tRD9tA2ToAEosrg0aXbFcKyxQ8yRrc5K6bMQWhZX-NxZFwh0tUHxD1iTc6yiZpDCubtq15HktxkD-kGcSy1fUeFuM8t4fd3PYt3GIrFZ-S-Ne0gTCWhLBtnF8OaYXcCr25ols8/s1600/django-404.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;106&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVLFix9tRD9tA2ToAEosrg0aXbFcKyxQ8yRrc5K6bMQWhZX-NxZFwh0tUHxD1iTc6yiZpDCubtq15HktxkD-kGcSy1fUeFuM8t4fd3PYt3GIrFZ-S-Ne0gTCWhLBtnF8OaYXcCr25ols8/s400/django-404.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Upssss, que paso aquí, como ya modificamos el archivo&lt;i&gt;&lt;b&gt; urls.py&lt;/b&gt;&lt;/i&gt;, Django, ve cuales son las URLs validas para el proyecto y estas son&lt;i&gt;&lt;b&gt; /admin&lt;/b&gt;&lt;/i&gt; y &lt;i&gt;&lt;b&gt;/admin/doc&lt;/b&gt;&lt;/i&gt;, ya que no hemos colocado la url raíz. corregimos la url en nuestro navegador de la siguiente manera:&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;http://127.0.0.1:8000/admin&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmGporsHGra7HqYvIlBuh6moU_e-yp_pyGiZAjkEYVWoo9fEcooKNDB0bADkOF9xnHftOWRKU1HP0r7GEAmRO2hy-qi1yK8mUH6Sap6PuOtYZVTshfw27ILW9m5vXp3deR8yOVCmud-ko/s1600/Django-admin.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;131&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmGporsHGra7HqYvIlBuh6moU_e-yp_pyGiZAjkEYVWoo9fEcooKNDB0bADkOF9xnHftOWRKU1HP0r7GEAmRO2hy-qi1yK8mUH6Sap6PuOtYZVTshfw27ILW9m5vXp3deR8yOVCmud-ko/s400/Django-admin.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora Django nos pide el usuario y contraseña, para ingresar al administrador, lo hacemos y tenemos la siguiente pantalla:&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwwb2jf7gqI7SaobWsmncNDvmVRTZy0Fd1TO9lcv89h6oaNEtXpu_Et1WRu3pma8qiN6MC-fkWqkBvQFpIT2gXvTVVGPzr3F7f0pitnDljcNsrzC8j7YJxNetTZgH6lyHxIbC9K3opzPk/s1600/Django-administrador.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;75&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwwb2jf7gqI7SaobWsmncNDvmVRTZy0Fd1TO9lcv89h6oaNEtXpu_Et1WRu3pma8qiN6MC-fkWqkBvQFpIT2gXvTVVGPzr3F7f0pitnDljcNsrzC8j7YJxNetTZgH6lyHxIbC9K3opzPk/s400/Django-administrador.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Hasta&amp;nbsp;aquí&amp;nbsp;esta segunda parte, cualquier duda, escriba en los comentarios y&amp;nbsp;así&amp;nbsp;lo compartimos con todos. Hasta la próxima</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/5997485014382749939/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2012/10/creando-aplicaciones-web-con-django-14.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/5997485014382749939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/5997485014382749939'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2012/10/creando-aplicaciones-web-con-django-14.html' title='Creando Aplicaciones Web con Django 1.4 (2da Parte)'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVLFix9tRD9tA2ToAEosrg0aXbFcKyxQ8yRrc5K6bMQWhZX-NxZFwh0tUHxD1iTc6yiZpDCubtq15HktxkD-kGcSy1fUeFuM8t4fd3PYt3GIrFZ-S-Ne0gTCWhLBtnF8OaYXcCr25ols8/s72-c/django-404.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-137322819366875991</id><published>2012-09-23T15:35:00.000-07:00</published><updated>2012-10-11T05:07:41.207-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="django-1.4"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Creando Aplicaciones Web con Django 1.4</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Después&amp;nbsp;de mucho tiempo de estar viendo tutoriales en internet, logré hacer una aplicación completamente funcional con el framework de python Django. &amp;nbsp;Es importante aclarar&amp;nbsp;&amp;nbsp;que es indispensable que usted tenga conocimientos básicos de python; para continuar, les recomiendo el libro llamado inmersión en &lt;a href=&quot;http://es.diveintopython.net/&quot;&gt;python.&lt;/a&gt;&amp;nbsp;el cual puedes descargar de la red.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este tutorial voy a crear una aplicación que tenga integración con base de datos, autenticación, reportes, JQuery, Css y alguna otra cosa que se nos ocurra.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En esta oportunidad voy a realizar una aplicación&amp;nbsp;que mi esposa me&amp;nbsp;había&amp;nbsp;pedido hace mucho tiempo, para guardar sus recetas de cocina, hay varias como estas en la red, solo que&amp;nbsp;aquí&amp;nbsp;nos iremos un poco mas alla de Django y le colocaremos los&amp;nbsp;juguetes&amp;nbsp;adicionales como JQuery y CSS.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Empecemos:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Este tutorial esta basado en la plataforma Linux, en la distribución que mas le guste, yo utilizo normalmente Ubuntu, actualmente en la&amp;nbsp;versión&amp;nbsp;12.04. En el caso de las personas que usan Windows, hay muchos manuales en la red de como hacerlo, para ello les invito a ver un excelente&amp;nbsp;vídeo&amp;nbsp;tutorial de&amp;nbsp;Alex Dzul en este &lt;a href=&quot;http://www.youtube.com/watch?v=AB0CtQJ9AYc&quot;&gt;enlace&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
En Ubuntu como en todas las distribuciones linux, ya viene instalado el python, por lo que no necesita instalarlo, entonces procedemos a instalar Django, el cual esta disponible en&amp;nbsp;código abierto bajo la licencia BSD. Se requiere la versión de Python 2.5 o superior, es importante saber que no depende de otras bibliotecas de Python. Y hay varias maneras de conseguirlo e instalarlo:&lt;br /&gt;
&lt;br /&gt;
1. con los repositorios que trae sus sistema operativo:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;$ sudo apt-get install python-django&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
2. Con &amp;nbsp;easy_install o pip, estos son instaladores de paquetes python, en cualquier sistema operativo, solo hay que tener previamente instalado alguno de los dos paquetes y proceder:&lt;br /&gt;
&lt;br /&gt;
Para utizar easy_install, este debe&amp;nbsp;instalarse previamente en Ubuntu con:&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;&lt;b&gt;$ sudo apt-get install python-setuptools&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Luego procedemos a instalar Django&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;
&lt;i&gt;&lt;b&gt;$ sudo easy_install django&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
pip es una herramienta para instalar y administrar paquetes de Python, como las que se encuentran en el índice de paquetes de Python. Es un reemplazo para easy_install.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;$ sudo apt-get install python-pip&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Para instalar django con pip solo hay que tipear:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;b&gt;$ sudo pip install Django&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
3. Bajarlo directamente de la página de django &lt;a href=&quot;http://www.djangoproject.com/&quot;&gt;http://www.djangoproject.com&lt;/a&gt;, esta es una de las mejores opciones porque&amp;nbsp;estarás&amp;nbsp;bajando la última&amp;nbsp;versión&amp;nbsp;o release de django. Descargamos este comprimido, normalmente se hace en Descargas y luego lo descomprimimos en nuestra carpeta personal&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;$ tar xzvf Django-1.4.1.tar.gz&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;$ cd Django-1.4.1&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Luego dentro de la carpeta ejecutamos el setup.py para instalarlo en nuestro sistema operativo.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;$ sudo python setup.py install&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Una vez que termine probamos la&amp;nbsp;instalación&amp;nbsp;en python&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;fquivera@fquivera-VGN-CR490E:~$ python&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Python 2.7.3 (default, Aug &amp;nbsp;1 2012, 05:16:07)&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;[GCC 4.6.3] on linux2&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;gt;&amp;gt;&amp;gt; import django&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Si no produce&amp;nbsp;ningún&amp;nbsp;error esta correctamente instalado, esta prueba es efectiva para cualquiera de las formas que&amp;nbsp;escogió&amp;nbsp;para instalar.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Muy bien, ya que tenemos instalado Django, vamos a proceder a crear nuestro primer proyecto, para ello nos ubicamos en nuestra carpeta personal y creamos la carpeta donde vamos a realizar nuestro proyecto.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;$ cd&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;$ mkdir django&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;$ cd django&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ahora vamos a crear nuestro primer proyecto que llamaremos recetas con el siguiente comando:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;$ django-admin.py startproject recetas&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Este nos creará una carpeta llamada recetas, entramos en ella y tenemos un archivo y una carpeta&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;$ cd recetas&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;recetas&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-style: italic; font-weight: bold;&quot;&gt;
├── manage.py&lt;/div&gt;
&lt;div style=&quot;font-style: italic; font-weight: bold;&quot;&gt;
└── recetas&lt;/div&gt;
&lt;div style=&quot;font-style: italic; font-weight: bold;&quot;&gt;
&amp;nbsp; &amp;nbsp; ├── __init__.py&lt;/div&gt;
&lt;div style=&quot;font-style: italic; font-weight: bold;&quot;&gt;
&amp;nbsp; &amp;nbsp; ├── settings.py&lt;/div&gt;
&lt;div style=&quot;font-style: italic; font-weight: bold;&quot;&gt;
&amp;nbsp; &amp;nbsp; ├── urls.py&lt;/div&gt;
&lt;div style=&quot;font-style: italic; font-weight: bold;&quot;&gt;
&amp;nbsp; &amp;nbsp; └── wsgi.py&lt;/div&gt;
&lt;div style=&quot;font-style: italic; font-weight: bold;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Expliquemos cada uno de estos archivos:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
La carpeta superior recetas es sólo un contenedor para su proyecto. Su nombre no le importa a Django, usted le puede cambiar el nombre a cualquier otro que le guste.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;manage.py: &lt;/b&gt;Una utilidad de línea de comandos que te permite interactuar de distintas formas con este proyecto Django. Utilizaremos muchas veces este programa utilitario a medida que avancemos en nuestro proyecto.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
La carpeta interna recetas es un paquete real Python para el proyecto. Su nombre es el nombre del paquete Python que tendrá que utilizar para importar cualquier cosa en su interior (por ejemplo, la importación recetas.settings).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;recetas / __init__.py:&lt;/b&gt; Un archivo vacío que le dice a Python que esta carpeta debe considerarse como un paquete Python. (Más información acerca de los paquetes en la documentación oficial de Python si usted es un principiante de Python.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;recetas / settings.py:&lt;/b&gt; Ajustes &amp;nbsp;y configuración para este proyecto Django. Aqui haremos todas las configuración del proyecto Django y &amp;nbsp;todo acerca de las opciones de trabajo.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;recetas / urls.py:&lt;/b&gt; Las declaraciones URL para el proyecto Django, es una &quot;tabla de contenidos&quot; de tu sitio Django. Puedes conocer más acerca de las URL en el &lt;a href=&quot;https://docs.djangoproject.com/en/1.4/topics/http/urls/&quot;&gt;despachador de URL&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;recetas / wsgi.py:&lt;/b&gt; Un punto de entrada para WSGI compatibles con servidores web para hospedar su proyecto. Veremos la manera de publicar su proyecto en un servidor mas adelante.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;El servidor de desarrollo&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Vamos a verificar que todo va bien. Revise que este en directorio superior de recetas, y ejecute el comando&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;$ python manage.py runserver&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Verá la siguiente salida en su terminal:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Validating models...&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;0 errors found&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Django version 1.4.1, using settings &#39;recetas.settings&#39;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Development server is running at http://127.0.0.1:8000/&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Quit the server with CONTROL-C.&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Ahora vaya a su navegador favorito y escriba la dirección http://127.0.0.1:8000 y le aparcera esta pagina:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFyBIRS_a-KqWBM686Rf648mZf-3E-V-zwpIpXQXCbJkIAWr-XGOFKWhb7kisM7ZUsu31FhvAKBimThJO-kBYNb8M5T6567aAVSH2lQOfDljd4mCTFTZ3VIN8pvSOHtI2G1jsvkPIz85A/s1600/itsWorked.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;152&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFyBIRS_a-KqWBM686Rf648mZf-3E-V-zwpIpXQXCbJkIAWr-XGOFKWhb7kisM7ZUsu31FhvAKBimThJO-kBYNb8M5T6567aAVSH2lQOfDljd4mCTFTZ3VIN8pvSOHtI2G1jsvkPIz85A/s400/itsWorked.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Hasta&amp;nbsp;aquí&amp;nbsp;esta primera parte, cualquier duda, escriba en los comentarios y&amp;nbsp;así&amp;nbsp;lo compartimos con todos. Hasta la proxima&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://laempresaconsoftwareabierto.blogspot.com/2012/10/creando-aplicaciones-web-con-django-14.html&quot;&gt;Segunda Parte&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/137322819366875991/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2012/09/creando-aplicaciones-web-con-django-14.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/137322819366875991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/137322819366875991'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2012/09/creando-aplicaciones-web-con-django-14.html' title='Creando Aplicaciones Web con Django 1.4'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFyBIRS_a-KqWBM686Rf648mZf-3E-V-zwpIpXQXCbJkIAWr-XGOFKWhb7kisM7ZUsu31FhvAKBimThJO-kBYNb8M5T6567aAVSH2lQOfDljd4mCTFTZ3VIN8pvSOHtI2G1jsvkPIz85A/s72-c/itsWorked.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-3616175823396946466</id><published>2011-06-23T20:06:00.000-07:00</published><updated>2011-06-23T20:06:23.578-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Canaima GNU/Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="decreto 3.390"/><category scheme="http://www.blogger.com/atom/ns#" term="Hidrobolívar"/><category scheme="http://www.blogger.com/atom/ns#" term="software libre"/><title type='text'>Hidrobolivar una empresa de Servicio 100 % Software libre</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;http://www.hidrobolivar.gob.ve/&quot;&gt;Hidrobolívar&lt;/a&gt;, C.A. es la empresa prestadora del servicio de agua potable  y saneamiento ambiental del Estado Bolívar&amp;nbsp;en la&amp;nbsp;República&amp;nbsp;Bolivariana  de Venezuela.&amp;nbsp;Sus accionistas son la Gobernación del Estado Bolívar y  sus once Alcaldías, cuya misión es &lt;i&gt;&quot;Proveer el servicio de agua  potable y saneamiento en &amp;nbsp;condiciones de óptima calidad, mediante un  modelo de gestión efectivo y sustentable, asegurando la satisfacción de  nuestros clientes y el desarrollo de una nueva cultura del agua  fundamentada en la valoración del recurso hídrico&quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Hidrobolívar&amp;nbsp;fue fundada el 26 de Marzo del 2005 y ya en Venezuela  existía&amp;nbsp;un marco legal que guiaba a las empresas publicas a la  modernización, tal es el caso del artículo 110 de nuestra Constitución  Nacional, donde se reconoce como de interés público, la ciencia, la  tecnología, el conocimiento, la innovación y los servicios de  información con el objeto de lograr el desarrollo económico, social y  político del país.&lt;br /&gt;
&lt;br /&gt;
A partir del 28 de Diciembre del 2004, se oficializo el uso de  software libre en la Administración Pública Nacional con el Decreto con  Fuerza de Ley No. 3.390.&amp;nbsp;Por lo tanto&amp;nbsp;Hidrobolívar&amp;nbsp;debía&amp;nbsp;seguir  estos&amp;nbsp;lineamientos&amp;nbsp;desde su fundación, ser una empresa innovadora y con  sus sistemas de información de acuerdo a las necesidades de sus clientes  y la comunidad. Por lo que&amp;nbsp;nació&amp;nbsp;Libre.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ahora bien,       ¿Por qué se dice una empresa cien por ciento libre?, es libre por que los sistemas que se utilizan son de arquitectura abierta y respecto al software propietario que se utiliza hay la libertad para cambiarlo, ya que estamos en constante evaluación de los mismos. No hay matrimonios obligados, ya que el software medular de la empresa es desarrollado por ella misma cumpliendo con las cuatro libertades.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;En cuanto al software utilizado tenemos:&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistemas Operativos: &lt;/b&gt;Centos en Servidores, Fedora, Ubuntu en estaciones&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistema de Directorio:&lt;/b&gt; LDAP, IPA Server, Proyecto 389&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistema de Autenticación: &lt;/b&gt;sssd, Kerberos&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistema de Archivos:&lt;/b&gt; Samba, NFS&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Servicio de Proxy:&lt;/b&gt; Squid&lt;br /&gt;
&lt;b&gt;Correo Electrónico:&lt;/b&gt; Posfix en Servidor, Evolution y Mozilla Thunderbird en Clientes&lt;br /&gt;
&lt;b&gt;Trabajo en Grupo: &lt;/b&gt;SOGO, DocManager&lt;br /&gt;
&lt;b&gt;Base de Datos:&lt;/b&gt; PostgresSQL, MySQL&lt;br /&gt;
&lt;b&gt;Sistema de Información Geográfico:&lt;/b&gt; Mapserver, GvSig, PostGis&lt;br /&gt;
&lt;b&gt;Lenguajes de Programación: &lt;/b&gt;PHP, Javascript, Ajax, python&lt;br /&gt;
&lt;b&gt;Central Telefónica:&lt;/b&gt; Asterisk, Elastix&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Ofimática: &lt;/b&gt;OpenOffice, LibreOffice&lt;br /&gt;
&lt;b&gt;Herramientas Cad:&lt;/b&gt; Bricscad&lt;br /&gt;
&lt;b&gt;Herramientas de Diagramas:&lt;/b&gt; Dia, Scribus&lt;br /&gt;
&lt;b&gt;Herramientas Gráficas:&lt;/b&gt; Gimp, Inkscape&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistema Administrativo:&lt;/b&gt; Merú Administrativo&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistema Comercial:&lt;/b&gt; Merú Comercial&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistema Recursos Humanos:&lt;/b&gt; Merú RRHH&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistema de Operaciones:&lt;/b&gt; Merú Operaciones&lt;br /&gt;
&lt;b&gt;HelpDesk:&lt;/b&gt; Merú Desk basado en GLPI&lt;br /&gt;
&lt;b&gt;Herramientas de Administración centralizada de estaciones de trabajo:&lt;/b&gt;&amp;nbsp;Puppet, Servidor de instalación desasistida y masiva Cobbler, Mirrors o Espejos de Distribuciones, control de inventario de equipos de computación, reproducción y perifericos con el OCS.&lt;br /&gt;
&lt;b&gt;Sistema de Moritoreo de Red:&lt;/b&gt; Nagios+MySQL+Nagvis&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Tal como comente en un mi articulo anterior &lt;a href=&quot;http://laempresaconsoftwareabierto.blogspot.com/2011/05/la-planificacion-elemento-esencial-en.html&quot;&gt;La Planificación, elemento esencial en la implantación del Software Libre&lt;/a&gt;, Merú es nuestro ERP o sistema de gestión de recursos empresariales, es un software hecho en Hidrobolívar para hidrológicas. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
También podrán apreciar que hay software que no es libre, mas tenemos la libertad de escoger el software a la medida de nuestras necesidades, ejemplo: la herramienta CAD, ya que el producto con que acostumbraron a trabajar a nuestros ingenieros tiene un valor económico cuatro veces mayor, y la alternativa que utilizamos hace lo mismo, y me atrevo a decir que tiene muchas mejoras y complementos con respecto al otro.&lt;br /&gt;
&lt;br /&gt;
Algunos se preguntaran       ¿Por qué Centos como Sistema&amp;nbsp;Operativo&amp;nbsp;para Servidores?,&amp;nbsp;quizás&amp;nbsp;porque es el que mas se ha adaptado a nuestros servicios y lo consideramos muy robusto y confiable, lo estamos utilizando desde que iniciamos el primer servidor. En cuanto a las estaciones, utilizamos Fedora y Ubuntu por que nos gustaron estas distribuciones de Linux, pero ya nos estamos preparando para cumplir la&amp;nbsp;disposición&amp;nbsp;publicada en Gaceta Oficial No. 39.633 donde los organismos y entes de la Administración Pública Nacional de la&amp;nbsp;República&amp;nbsp;Bolivariana de Venezuela&amp;nbsp;deberán&amp;nbsp;utilizar Canaima GNU/Linux como sistema operativo&amp;nbsp;en sus estaciones de trabajo, cambio que no sera traumático para los usuarios. Esas son algunas de las ventajas que brinda la libertad del Software libre.&lt;br /&gt;
&lt;br /&gt;
Beneficios que ha traído el software libre a Hidrobolívar:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Una sola plataforma de comunicaciones&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Voz y data en el mismo canal de comunicaciones&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;Integración de servicios de voz y datos&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Servicio telefónico de notificación de deuda&lt;/li&gt;
&lt;li&gt;Saldo en línea (vía web y telefónico)&lt;/li&gt;
&lt;li&gt;Autogestionado de Salud Telefónico&lt;/li&gt;
&lt;li&gt;Notificación de deuda vía correo electrónico&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;Indicadores de Gestión para la toma de decisiones&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;ul&gt;&lt;li&gt;La alta gerencia tiene acceso a indicadores de gestión precisos y en línea directa de los sistemas administrativo, comercial y recursos humanos.&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Gasto convertido en inversión&lt;/b&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;El dinero que se utilizaría para pago de licencias se utiliza para entrenamiento de personal&lt;/li&gt;
&lt;li&gt;Ahorro anual aproximado de&amp;nbsp; $ 430.860,74&amp;nbsp; unos Bs. 1.851.944,21 (4,30x$)&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Sistemas Adaptados a las necesidades del cliente &lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;ul&gt;&lt;li&gt;Al contar con un sistema propio, es totalmente factible la integración con distintas plataformas para ofrecer alternativas de atención a los clientes, tales como Bancos, Farmacias, Supermercados, entre otros, a través de un portal de Web Services.&lt;/li&gt;
&lt;/ul&gt;Por esto y muchas cosas mas, podemos decir que Hidrobolívar es una empresa cien por ciento libre, la inversión realizada en tecnología esta allí, no en otro país, contamos con asesoramiento de empresas y cooperativas nacionales y locales&amp;nbsp; que nos ayudan a mantener la plataforma, ya que somos una empresa de servicio de saneamiento y agua potable, que ha demostrado que sí se puede lograr una empresa con la libertad para escoger sus herramientas de gestión sin necesidad de adaptarse a modelos importados que traen otras realidades que no son las nuestras, y esto solo se logra con el software libre.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/3616175823396946466/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/06/hidrobolivar-una-empresa-de-servicio.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/3616175823396946466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/3616175823396946466'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/06/hidrobolivar-una-empresa-de-servicio.html' title='Hidrobolivar una empresa de Servicio 100 % Software libre'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-58649759908611377</id><published>2011-06-18T17:18:00.000-07:00</published><updated>2011-06-18T17:18:48.605-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="legal"/><category scheme="http://www.blogger.com/atom/ns#" term="pirata"/><category scheme="http://www.blogger.com/atom/ns#" term="propietario"/><category scheme="http://www.blogger.com/atom/ns#" term="software libre"/><title type='text'>Software Privativo, Libre, Pirata ¿Cuál opción escoger?</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Cuando conocí a Ana, mi esposa, me resultaba tan curioso observar como una persona se encontraba tan inmersa en el mundo del &quot;Windows&quot;, y tan directamente condicionada a asociar equipos de computación con &quot;Microsoft Office&quot;. Pasaba días transcribiendo sus trabajos en el usual &quot;Word&quot;, así como pasaba horas enteras diseñando sus presentaciones en el clásico &quot;Power Point&quot;. Para ella, automáticamente al encender su computadora, era casi&amp;nbsp;instantáneo&amp;nbsp;visualizar antes que apareciera, aquella banderita de colores que le indicaba &amp;nbsp;que su sistema operativo era una licencia de Windows; y de este modo por mucho tiempo, asumió que toda computadora era así, que el mundo de la informática pertenecía exclusivamente a Microsoft y su creador se dedicaba no solo a fabricar computadoras sino a colocar lo que dentro de ella venia, sin pensar siquiera la posibilidad remota de la existencia del uno sin el otro y viceversa. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Creo que esta pequeña&amp;nbsp;anécdota no es extraña para nadie, al punto que inclusive hoy día forma parte de la realidad de muchas personas, de la cual ya ni ella ni yo somos parte, afortunadamente. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Es por ello, que me parece conveniente, traer hoy día esta reflexión, y expandir un poco el horizonte de quienes aún navegan en el exclusivo mar de las licencias privadas, bien porque la adquirieron de modo legal o sencillamente porque se encuentran frente a una reproducción ilegal de la misma, mejor conocida como software pirata.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Empezaremos primeramente definiendo que es software legal: Es aquel que se utiliza con el consentimiento de su creador o dueño, ya sea por medio de una licencia o sin ella, y puede adquirirse pagando&amp;nbsp;dicha licencia o de forma gratuita.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Por otro lado, encontramos el software libre, cuya traducción del inglés&amp;nbsp;&quot;free&amp;nbsp;software&quot;&amp;nbsp;ha generado una ambigüedad que ha hecho pensar que todo es gratis, y sin embargo no es obligatorio que sea así, por lo tanto no hay que asociar que todo software libre es gratis (denominado usualmente freeware), ya que conservando su carácter de libre, puede ser distribuido comercialmente (software comercial).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Análogamente, el &quot;software gratis&quot; &amp;nbsp;incluye en ocasiones el código fuente; no obstante, este tipo de software no es libre en el mismo sentido que el software libre, a menos que se garanticen los derechos de modificación y redistribución de dichas versiones modificadas del programa. Para ser mas precisos y ya que se tiende a confundir, la realidad es la denominación del software que respeta la libertad de los usuarios sobre su producto adquirido, y por tanto, una vez obtenido puede ser usado, copiado, estudiado, modificado y redistribuido libremente.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;También&amp;nbsp;existe el software de dominio público, que no debe confundirse tampoco con el software libre, ya que este tipo de software no requiere licencia, pues sus derechos de explotación son para toda la humanidad, pertenece a todos por igual y cualquiera puede hacer uso de el, siempre con fines legales y&amp;nbsp;refiriéndose&amp;nbsp;al autor original, ya que este lo ha donado a la humanidad o puede ser el caso que los derechos de autor han expirado, tras un plazo contado desde la muerte de su creador, que generalmente son unos 70 años. Si un autor condiciona su uso bajo una licencia, por muy&amp;nbsp;débil&amp;nbsp;que sea, ya no es un software de dominio público.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;El software&amp;nbsp;propietario&amp;nbsp;llamado&amp;nbsp;también&amp;nbsp;privativo, de código cerrado o software no libre, es cualquier programa informático en el que el usuario tiene limitaciones para usarlo, modificarlo o redistribuirlo (esto último con o sin modificaciones), tal es el caso del conocido Windows.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;La persona natural o jurídica al poseer los derechos de autor sobre un software, tiene la posibilidad de controlar y restringir los derechos del usuario sobre su programa, lo que en el software propietario implica por lo general que el usuario sólo tendrá derecho a ejecutar el software bajo ciertas condiciones, comúnmente fijadas por el proveedor, que signifique la restricción de una o varias de las cuatro libertades.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ahora bien, que usar &amp;nbsp;¿libre, propietario o pirata?, indudablemente que con la adquisición de un&amp;nbsp; software pirata la empresa corre el riesgo de ser sancionada en caso de realizarse los debidos controles, &amp;nbsp;por lo tanto esta opción debe ser descartada. Pero esto nos lleva mucho mas allá, &amp;nbsp;nos lleva precisamente al problema cultural -no&amp;nbsp;técnico-, y es que nos enseñaron -y lo peor-, nos acostumbraron &amp;nbsp;a usar una herramienta que la consigues en cualquier esquina &amp;nbsp;-ilegalmente por supuesto- y cuando vamos a las empresas, éstas tienen que pagar una licencia, porque las personas&amp;nbsp;jurídicas&amp;nbsp;son mas&amp;nbsp;fáciles&amp;nbsp;de fiscalizar; &amp;nbsp;al respecto hay un excelente articulo escrito por &lt;b&gt;@w3asel&lt;/b&gt; cuyo enlace les dejo&amp;nbsp;&lt;a href=&quot;http://w3asel.wordpress.com/2010/07/20/software-libre-el-gran-afectado-con-el-software-pirata-y-el-gran-beneficiado-la-industria-privativa/&quot;&gt;aquí&lt;/a&gt;, donde profundiza muy acertadamente este problema.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;En Venezuela existe la Ley Especial contra los delitos informáticos, publicada en la Gaceta Oficial numero 37.313 el 30 de Octubre del 2001, &amp;nbsp;donde se castiga el acceso indebido a un sistema, penado con prisión de uno a cinco años y multa de 10 a 50 unidades tributarias (UT), &amp;nbsp;así como la&amp;nbsp;apropiación indebida de propiedad intelectual mediante la reproducción, divulgación,&amp;nbsp;modificación&amp;nbsp;o copia de un software, penado con prisión de uno a cinco años y multa de 100 a 500&amp;nbsp;UT: sin embargo a pensar de contar con la legislación que tipifica el delito y sanciona la acción, su efectiva aplicación aún no es la mas idónea.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Aún contando con el contexto anterior, y haciendo a un lado la existencia del software pirata, entonces, ¿Porque las empresas no utilizan el software libre?, ¿Por soporte? no lo creo, cada&amp;nbsp;día&amp;nbsp;hay mas empresas que dan soporte al software libre, y si es por eso, podemos hablar de un sistema operativo&amp;nbsp;propietario&amp;nbsp;como lo es el Windows XP que no tiene soporte desde hace mucho tiempo y aun así lo siguen usando. Usar software libre facilita las condiciones para la&amp;nbsp;creación&amp;nbsp;de nuevo software, adaptado a las necesidades que se tengan y podamos brindar mejor calidad a nuestros clientes ya que es conocimiento, y ésta es la base de la&amp;nbsp;economía&amp;nbsp;del futuro. Los argumentos para la no&amp;nbsp;utilización&amp;nbsp;del software libre se han acabado: primero, existe gran cantidad de software de calidad que hace lo mismo que el propietario y solo esta al alcance de un click, así como también conseguirá algunos con un costo muchísimo menor que el que nos acostumbraron a utilizar.&amp;nbsp; La herramienta está al alcance de sus manos, solo atrévase. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/58649759908611377/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/06/software-privativo-libre-pirata-cual.html#comment-form' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/58649759908611377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/58649759908611377'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/06/software-privativo-libre-pirata-cual.html' title='Software Privativo, Libre, Pirata ¿Cuál opción escoger?'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-7275854080764628925</id><published>2011-05-09T19:40:00.000-07:00</published><updated>2011-05-09T19:40:56.274-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="abierto"/><category scheme="http://www.blogger.com/atom/ns#" term="decreto 3.390"/><category scheme="http://www.blogger.com/atom/ns#" term="empresa"/><category scheme="http://www.blogger.com/atom/ns#" term="ERP"/><category scheme="http://www.blogger.com/atom/ns#" term="Hidrobolívar"/><category scheme="http://www.blogger.com/atom/ns#" term="planificación"/><category scheme="http://www.blogger.com/atom/ns#" term="software libre"/><title type='text'>La Planificación, elemento esencial en la implantación del Software Libre</title><content type='html'>La planificación es un paso crítico en todo proyecto, que debe hacerse bien para evitar problemas futuros. El definir desde el principio cómo serán las bases del proyecto y estar soportadas por la inteligencia del negocio, nos evitara desperdiciar recursos y materiales. La planificación es un elemento&amp;nbsp;esencial que&amp;nbsp;muchos gerentes parecen no comprender y no le dan la debida importancia. En este articulo trataremos el tema desde la perspectiva de una empresa basada en software libre.&lt;br /&gt;
&lt;br /&gt;
Hidrobolívar, C.A. es la empresa prestadora del servicio de agua potable y saneamiento ambiental del Estado Bolívar&amp;nbsp;en la&amp;nbsp;República&amp;nbsp;Bolivariana de Venezuela.&amp;nbsp;Sus accionistas son la Gobernación del Estado Bolívar y sus once Alcaldías, cuya misión es &lt;i&gt;&quot;Proveer el servicio de agua potable y saneamiento en &amp;nbsp;condiciones de óptima calidad, mediante un modelo de gestión efectivo y sustentable, asegurando la satisfacción de nuestros clientes y el desarrollo de una nueva cultura del agua fundamentada en la valoración del recurso hídrico&quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Hidrobolívar&amp;nbsp;fue fundada el 26 de Marzo del 2005 y ya en Venezuela existía&amp;nbsp;un marco legal que guiaba a las empresas publicas a la modernización, tal es el caso del artículo 110 de Nuestra Constitución Nacional, donde se reconoce como de interés publico, la ciencia, la tecnología, el conocimiento, la innovación y los servicios de información con el objeto de lograr el desarrollo económico, social y político del país.&lt;br /&gt;
&lt;br /&gt;
Y a partir del 28 de Diciembre del 2004, se oficializo el uso de software libre en la Administración Publica Nacional con el Decreto con Fuerza de Ley No. 3.390.&amp;nbsp;Por lo tanto&amp;nbsp;Hidrobolívar&amp;nbsp;debía&amp;nbsp;seguir estos&amp;nbsp;lineamientos&amp;nbsp;desde su fundación, ser una empresa innovadora y con sus sistemas de información de acuerdo a las necesidades de sus clientes y la comunidad. Por lo que&amp;nbsp;nació&amp;nbsp;Libre.&lt;br /&gt;
&lt;br /&gt;
El Software Libre y el Conocimiento, nos lanzan un reto para la innovación, donde tenemos disponibles los elementos necesarios para la construcción de un modelo de desarrollo libre e independiente, sin otro límite que la propia creatividad y la capacidad de innovación de cada uno, contribuyendo a ampliar la libertad e igualdad de oportunidades de progreso.&amp;nbsp;Este reto nos lleva a:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Repensar la gestión de las tecnologías de información&lt;/li&gt;
&lt;li&gt;Crear nuevos modelos&lt;/li&gt;
&lt;li&gt;Mejorar las relaciones con nuestros clientes&lt;/li&gt;
&lt;li&gt;Independencia con los proveedores de Software&lt;/li&gt;
&lt;li&gt;La Modernización del estado&lt;/li&gt;
&lt;/ol&gt;El principal objetivo es lograr obtener el control de nuestro negocio, por supuesto, esto no es tarea&amp;nbsp;fácil, ya que es un trabajo constante y de mucha resistencia, quizás de muchos años, donde se necesita la misma determinación con que valoramos nuestra libertad y la protegemos a cualquier costo.&amp;nbsp;Estas premisas nos hizo crear una estrategia&amp;nbsp;tecnológica&amp;nbsp;basada en los procesos del negocio, que no es mas que nuestra misión y visión como empresa, el porque existimos; la estrategia de&amp;nbsp;tecnología, que se basa principalmente en el decreto 3.390 y las&amp;nbsp;tecnologías&amp;nbsp;de información existentes en el mercado enmarcadas dentro de este decreto (ver Figura)&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8g8F1AktweZ9nhmh3FtqS7DaBGg1FNA6e_VVy5wXcUMZcOwBIDsunJj7jGwfyNKwYPzVihM4hG7RyOviQx-c25s0vBLWeGzglRxhYAv0QylJaWjXLgYx6v9vyxZVJPzmy6DWlD4cQfCQ/s1600/estrategia-TI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8g8F1AktweZ9nhmh3FtqS7DaBGg1FNA6e_VVy5wXcUMZcOwBIDsunJj7jGwfyNKwYPzVihM4hG7RyOviQx-c25s0vBLWeGzglRxhYAv0QylJaWjXLgYx6v9vyxZVJPzmy6DWlD4cQfCQ/s400/estrategia-TI.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Estrategia&amp;nbsp;Tecnológica&amp;nbsp;de Hidrobolivar, C.A.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;La unión de estos tres elementos nos proporcionan servicios de&amp;nbsp;tecnología&amp;nbsp;e infraestructura que al final van al servicio del cliente, a quien nos debemos.&amp;nbsp;Con estas premisas,&amp;nbsp;Hidrobolívar&amp;nbsp;planifico primeramente su infraestructura&amp;nbsp;tecnológica, que se&amp;nbsp;convirtió&amp;nbsp;en la base de sus sistemas de&amp;nbsp;información&amp;nbsp;y poder tener la&amp;nbsp;interrelación&amp;nbsp;de cada uno de los sistemas y&amp;nbsp;así&amp;nbsp;evitar las islas de información, basado primeramente en un sistema integral donde todos los procesos de la empresa convergen, este macro sistema lo llamamos merú.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpqXo3dgLi_ovbp5_nqjXyR9IzJtUGAICrNLLh2awggAeSDtBJLsuIolmxmcqufUTtNFPZbKJ1cTFPdSLsOx7fMkwuXS66b4pzX4C9LPsT2ocgT6j-RbFq7d-Dny1IDHcHG7afyHSKj38/s1600/arquitectura-HB.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpqXo3dgLi_ovbp5_nqjXyR9IzJtUGAICrNLLh2awggAeSDtBJLsuIolmxmcqufUTtNFPZbKJ1cTFPdSLsOx7fMkwuXS66b4pzX4C9LPsT2ocgT6j-RbFq7d-Dny1IDHcHG7afyHSKj38/s400/arquitectura-HB.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Arquitectura&amp;nbsp;Tecnológica&amp;nbsp;de Hidrobolivar, C.A.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;Merú -cuyo significado en el &lt;a href=&quot;http://es.wikipedia.org/wiki/Idioma_pem%C3%B3n&quot;&gt;idioma pemón &lt;/a&gt;es salto de agua o cascada-, es un nombre escogido para nuestro sistema, primero porque nos identifica nuestra&amp;nbsp;razón&amp;nbsp;de ser, la potabilización del agua y su saneamiento y segundo que es&amp;nbsp;autóctono&amp;nbsp;de nuestra región, el estado&amp;nbsp;Bolívar.&lt;br /&gt;
&lt;br /&gt;
Ahora, Merú es nuestro &lt;a href=&quot;http://es.wikipedia.org/wiki/Planificaci%C3%B3n_de_recursos_empresariales&quot;&gt;sistema de planificación de recursos empresariales&lt;/a&gt; o ERP, es un sistema de información gerencial &amp;nbsp;que integra y maneja los procesos asociados con las operaciones del servicio de potabilización &amp;nbsp;y saneamiento del agua.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsJc0fo04q4ZtdjipAfPt8H3FJPuxtSlbExXZdcu6BtaLbhw2N12HPCBDj-nmC-hoo5IyQoyqPkTCbg5tGnc7AB3MHvusUfgAqm8U5dQHBkp2qj2tg0kFSMVycO7AGdAnYBLG1Q7pnUZI/s1600/meru.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;318&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsJc0fo04q4ZtdjipAfPt8H3FJPuxtSlbExXZdcu6BtaLbhw2N12HPCBDj-nmC-hoo5IyQoyqPkTCbg5tGnc7AB3MHvusUfgAqm8U5dQHBkp2qj2tg0kFSMVycO7AGdAnYBLG1Q7pnUZI/s400/meru.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Como podemos apreciar en la figura, tenemos los diferentes&amp;nbsp;módulos&amp;nbsp;de merú, con una clara interrelación&amp;nbsp;entre ellos, ya que la información se comparte y evita la&amp;nbsp;multiplicidad&amp;nbsp;del dato, brindando una calidad del mismo, para luego ser convertido en información e indicadores de gestión que proporcionara a la alta gerencia herramientas para la toma de&amp;nbsp;decisiones.&lt;br /&gt;
&lt;br /&gt;
Para finalizar, debo decir que para implantar cualquier sistema de&amp;nbsp;información&amp;nbsp;gerencial, es importante tener claro el proceso del negocio, las metas y objetivos del mismo; y de&amp;nbsp;allí&amp;nbsp;alinear las&amp;nbsp;tecnologías&amp;nbsp;de información para lograr una sinergia efectiva entre ambas estrategias, lo cual es un principio fundamental dentro de la empresa.&amp;nbsp;La&amp;nbsp;planificación nos permite lograr la&amp;nbsp;claridad de metas y objetivos, y está indicada como un factor clave de éxito para la implantación de sistemas ERP. Es trasladar la visión de la compañía y la estrategia que resulta de esta visión en prioridades concretas, y decidir exactamente cómo la implantación de un sistema de&amp;nbsp;información&amp;nbsp;gerencial como merú puede ayudar a la empresa a lograr sus objetivos.</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/7275854080764628925/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/05/la-planificacion-elemento-esencial-en.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/7275854080764628925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/7275854080764628925'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/05/la-planificacion-elemento-esencial-en.html' title='La Planificación, elemento esencial en la implantación del Software Libre'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8g8F1AktweZ9nhmh3FtqS7DaBGg1FNA6e_VVy5wXcUMZcOwBIDsunJj7jGwfyNKwYPzVihM4hG7RyOviQx-c25s0vBLWeGzglRxhYAv0QylJaWjXLgYx6v9vyxZVJPzmy6DWlD4cQfCQ/s72-c/estrategia-TI.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-6319697368560259136</id><published>2011-04-05T07:54:00.000-07:00</published><updated>2011-04-18T06:59:52.562-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="abierto"/><category scheme="http://www.blogger.com/atom/ns#" term="decreto 3.390"/><category scheme="http://www.blogger.com/atom/ns#" term="empresa"/><category scheme="http://www.blogger.com/atom/ns#" term="Hidrobolivar"/><category scheme="http://www.blogger.com/atom/ns#" term="software libre"/><title type='text'>Estrechamos lazos con otras hidrológicas del país</title><content type='html'>&lt;div&gt;La gestión de Hidrobolívar de tan sólo 6 años, ya es motivo de referencia nacional, especialmente en las áreas de tecnología y proyectos, donde otras hidrológicas del país han comenzado a manifestar su interés.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;En este sentido, Hidrobolívar ha recibido varias representaciones de hidrológicas hermanas en su sede de la UD-321, en Puerto Ordaz. Recientemente Hidrocaribe, así como Aguas de Monagas y Aguas de Yaracuy, además del apoyo aportado a Hidrollanos en años anteriores.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;El Lic. Francisco Quivera, Vice Presidente y Gerente de Tecnología e Informática, ha explicado que se están fomentando estos encuentros con miras a establecer convenios interinstitucionales de intercambio con otras hidrológicas para beneficio de ambas partes. “Ver en qué área las otras empresas son fuertes y en qué áreas nosotros somos fuertes y que al final de este trueque los beneficiados sean los integrantes de la comunidad”.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;En las reuniones se han tratado diferentes temas concernientes a la labor que ejecuta cada empresa, entre los que se pueden mencionar la perforación de pozos profundos con el uso de maquinarias, aportes en el área informática, planes estratégicos con empresas internacionales, etc.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Uno de los aspectos más llamativos para el resto de las hidrológicas es el hecho de haber consolidado en Hidrobolívar una plataforma tecnológica con estándares libres que cumple con el decreto presidencial con fuerza de Ley 3.390, el cual habla de la obligación de la administración pública del uso de software libres. El sistema desarrollado por Hidrobolívar además es un conglomerado integral de las áreas administrativa, comercial y de recursos humanos, que facilita la planificación, el estatus de la gestión y el manejo integral de la hidrológica para la toma de decisiones en beneficio de la comunidad.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Se plantea así la posibilidad de la transferencia tecnológica por parte de Hidrobolívar hacia otras hidrológicas, en principio con la implementación del Sistema Comercial MERÚ que permite agilizar el proceso de facturación, casos de catastro, atención al cliente, optimizando de esta manera la atención al cliente y el proceso de cobranza, fundamental para la sustentabilidad del servicio de agua.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Los especialistas de Hidrobolívar han capacitado a los empleados de Hidrollanos, Aguas de Yaracuy e Hidrocaribe, en cuanto al uso y manejo de este software, y se preparan para la puesta en práctica de los compromisos asumidos en dichos convenios interinstitucionales. Próximamente se sumará Aguas de Monagas.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;Fuente:&lt;/b&gt; Prensa&amp;nbsp;Hidrobolívar, C.A.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/6319697368560259136/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/04/estrechamos-lazos-con-otras.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/6319697368560259136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/6319697368560259136'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/04/estrechamos-lazos-con-otras.html' title='Estrechamos lazos con otras hidrológicas del país'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6232554193087666894.post-1683037573674550112</id><published>2011-03-19T18:28:00.000-07:00</published><updated>2011-04-18T06:59:52.562-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="abierto"/><category scheme="http://www.blogger.com/atom/ns#" term="decreto 3.390"/><category scheme="http://www.blogger.com/atom/ns#" term="empresa"/><category scheme="http://www.blogger.com/atom/ns#" term="Hidrobolivar"/><category scheme="http://www.blogger.com/atom/ns#" term="software libre"/><title type='text'>Miedo a lo desconocido</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;A lo largo de mi carrera, me he dado cuenta que aquellos que tenemos mas miedo a los cambios somos los profesionales de tecnología o de sistemas; esta afirmación me atrevo a expresarla, porque mientras tengamos un sistema que funcione con sus limitaciones, pero que funcione en si, siempre nos dará miedo el cambiar o el innovar.  Es precisamente aquí donde voy con el tema que nos compete.... el miedo al cambio, el miedo a lo desconocido.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Desde el inicio de la era tecnológica fuertemente marcada por la venta de las computadoras, nos acostumbraron a una única manera de pensar a través único sistema operativo (Conocido como MS-Windows); nos enseñaron  que todo giraba en torno a él, ya que las aplicaciones creadas por los fabricantes de software solo trabajaban para él.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Cuando Linus Torvalds el 5 de Octubre de 1991 anuncio la primera versión de Linux, capaz de ejecutar un shell  (BASH), con un compilador de C mejor conocido como gcc, cambio radicalmente la perspectiva y nos dio otra manera de ver el mundo de la informática y principalmente nos&amp;nbsp;concedió: libertad, libertad para escoger el sistema operativo que quiero, programar lo que quiero y adaptarlo a mis necesidades, en fin... Libertad.&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Al paso del tiempo Linux se ha convertido en el sistema operativo que utilizan la mayoría de los servidores web en el mundo con Apache, y dio pie a la creación de aplicaciones nuevas, como es el caso de Firefox, el navegador mas popular.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Entonces, esto nos lleva a la siguiente pregunta: ¿Por qué el miedo? ¿Por qué no cambiarnos a Software Libre? ¿Qué nos impide dejar de pagar costosas licencias? ¿Por qué no reinvertir ese dinero en capacitación de personal? o mejor invertir ese dinero en nuestros países y pagarles a nuestros programadores criollos, que han demostrado que las cosas se pueden lograr.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Les diré que pasa, no creemos, al no creer en nosotros mismos, buscamos depender de otro al que podamos echarle la culpa de nuestros fracasos, le tenemos miedo hasta el cambiar una herramienta tan simple como una suite de oficina. Openoffice no tiene ninguna diferencia en cuanto a productividad con respecto a MS-Office,&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;, serif;&quot;&gt;¡&lt;/span&gt;nada! pero nos acostumbraron a el y nos sentimos como pez fuera del agua cuando nos dicen que tenemos que trabajar con otra herramienta. Hay excusas como la siguiente: yo no he hecho curso de eso, les pregunto ¿Donde esta el certificado del curso de MS-Office? nadie lo tiene, porque hay otro gran problema, y es que nuestras Universidades no se dan a la tarea de enseñarnos que hay otras opciones y otras herramientas que&amp;nbsp;fácilmente&amp;nbsp;podemos utilizar. Recuerdo que antes de que explotara el auge de programación de PHP, todo era Visual Basic, todas las clases de programación se daban en ese entorno, ahora es PHP, esta muy bien, es un lenguaje libre, pero no puede faltar el WAMP, que nos monta todo sobre MS-Windows, con solo hacer siguiente, siguiente a través de un asistente. Deberían enseñar primero sobre los diferentes sistemas operativos existentes y no solo uno. En si, no darle el pan en la boca a los programadores nuevos, sería mejor enseñarles &amp;nbsp; como buscarlo y que tienen miles de opciones.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Como ven, este tema es muy extenso y nos dará mucho de que hablar, algunos dirán, si ya alguien lo hizo para que voy hacerlo de nuevo?, yo diría lo mismo, pero en nuestras Universidades deberíamos crear innovadores, no seguidores, ni imitadores, además en el caso de una empresa debemos adaptarnos al proceso del negocio, y no traer e implantar negocios hechos en otras esferas y con sus particularidades.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;Muchas empresas han demostrado que el Software Libre es una alternativa, les conversaré a lo largo de este blog de mi experiencia personal en &lt;a href=&quot;http://hidrobolivar.gob.ve/&quot;&gt;Hidrobolivar, C.A&lt;/a&gt;., una empresa Hidrológica creada por la Gobernación del Estado Bolívar y las once Alcaldías para saldar la deuda social en materia de agua potable y saneamiento en el estado Bolívar,&amp;nbsp;República&amp;nbsp;Bolivariana de Venezuela, cuyos sistemas se encuentran basados en el &lt;a href=&quot;http://asl.mct.gob.ve/index.php?option=com_content&amp;amp;view=article&amp;amp;id=83&amp;amp;Itemid=123&quot;&gt;decreto 3.390,&lt;/a&gt;&amp;nbsp;referente a la Administración Pública y su asociación directa al Software Libre. E&lt;/span&gt;l reto en Hidrobolívar, fue repensar la gestión en Tecnologías de Información, aprovechar los beneficios del Software Libre para reestructurar la plataforma tecnológica en busca de la eficiencia y la eficacia de los procedimientos, como resultado de mayor independencia con los proveedores de software, nuevos modelos de gestión y modernización del Estado y darle a su&amp;nbsp;razón&amp;nbsp;de ser &amp;nbsp;-los clientes- un mejor servicio.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://laempresaconsoftwareabierto.blogspot.com/feeds/1683037573674550112/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/03/miedo-lo-desconocido.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/1683037573674550112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6232554193087666894/posts/default/1683037573674550112'/><link rel='alternate' type='text/html' href='http://laempresaconsoftwareabierto.blogspot.com/2011/03/miedo-lo-desconocido.html' title='Miedo a lo desconocido'/><author><name>fquivera</name><uri>http://www.blogger.com/profile/15998587717477864578</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>