Ver Mensaje Individual
  #3  
Antiguo 03-04-2011
Avatar de Julián
Julián Julián is offline
Merodeador
 
Registrado: may 2003
Ubicación: en mi casa
Posts: 2.019
Reputación: 10
Julián Va por buen camino
Creamos una carpeta pyhton y dentro creamos un proyecto, y editamos el archivo settings.py en el cual ponemos el user y pass y dbname de una base de datos previamente creada, con mysql, aunque puede usarse cualquier otra.

#mkdir python
#cd python/
#django-admin startproject pruebas
#cd pruebas
#vi settings.py
#python manage.py syncdb


Aqui obtenemos un error:

File "/usr/lib/pymodules/python2.6/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb


A ver si es que necesitamos instalar el paquete python-mysql:
#sudo aptitude install python-mysqldb

Probamos de nuevo:
#python manage.py syncdb
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (Leave blank to use 'nailuj'):
E-mail address: julian@clubdelphi.com
Password:
Password (again):
Superuser created successfully.
Installing index for auth.Permission model
Installing index for auth.Group_permissions model
Installing index for auth.User_user_permissions model
Installing index for auth.User_groups model
Installing index for auth.Message model
No fixtures found.


Ahora sí que vá. Y podemos ver el resultado lenzando el script en la shell:
#python manage.py runserver 0.0.0.0:8000
y abriendo la url en el navegador:
http://<mi_server>:8000
__________________
"la única iglesia que ilumina es la que arde"
Anonimo

Última edición por Julián fecha: 03-04-2011 a las 05:08:25.
Responder Con Cita