This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cuando queremos crear de nuevo la base de datos y da este error: | |
ERROR 1396 (HY000) at line 11: Operation CREATE USER failed for 'admin'@'localhost' | |
Se corrige: | |
$ mysql -u root -proot | |
drop user admin@localhost; | |
flush privileges; | |
exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2014-01-05T00:00:00Z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1º Editar el fichero models.py he introducir el cambio | |
2º Ir a la consola y en el proyecto ejecutar estos tres comandos | |
./manage.py schemamigration conta --auto | |
./manage.py migrate conta | |
./manage.py syncdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 1000 | |
numbers = range (2, n) | |
print "numbers =", numbers | |
results = [] | |
i = 0 | |
while (len(numbers) > 0): | |
results.append(numbers.pop(0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydict = {'george':16,'amber':19} | |
print mydict.keys()[mydict.values().index(16)] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bombadil@barbol:~/Proyectos/miprimerproyecto$ python manage.py shell | |
>>> from polls.models import Poll, Choice | |
>>> Poll.objects.all() | |
[] | |
>>> # Creamos una nueva encuesta | |
>>> from datetime import datetime | |
>>> p = Poll(question="Como estas?", pub_date=datetime.now()) | |
>>> # Guardamos el objeto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
He seguido el tutorial: | |
http://django.es/docs/intro/tutorial01/ | |
- Para crear un proyecto: | |
$ django-admin.py startproject miprimerproyecto | |
- Para ejecutar el proyecto: | |
$ cd miprimerproyecto | |
$ python manage.py runserver 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Acceder con el usuario postgres: | |
$ sudo su - postgres | |
- Para seleccionar una bbdd que se llama ring: | |
$ psql ring | |
- Para ver el litado de las tablas: | |
# \dt | |
- Para ver el contenido de una tabla: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Abrir una consola ssh: | |
$ cd public_html/magento/ | |
$ php shell/indexer.php reindexall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_file = open("output.txt", "r") | |
print my_file.read() | |
my_file.close() |
NewerOlder