Je suis sur —Debian Squeeze et en faisant exactement la manipulation
de Thomas, — j'ai psycopg2 bien installé. Je ne comprends pas pourquoi
tu as ce problème sous Ubuntu. J'ai comme l'impression que psycopg2
n'est pas dans le site-packages.
Etape 7 — Intaller postgresql
Etape 8 — Creer 'mypguser' et 'mypgdatabase'
Etape 9 — JE Update le fichier settings.py de django avec mypguser ,
mypguserpass mypgdatabase
Etape 10 — Enfin Je syncdb
1 — Installer psycopg2
root@pat762x:/home/alioune# apt-get install python-psycopg2
python-egenix-mxtools_3.1.3-4_i386.deb) ...
Sélection du paquet python-egenix-mxdatetime précédemment désélectionné.
Dépaquetage de python-egenix-mxdatetime (à partir de .../
python-egenix-mxdatetime_3.1.3-4_i386.deb) ...
Sélection du paquet python-psycopg2 précédemment désélectionné.
Dépaquetage de python-psycopg2 (à partir de .../
python-psycopg2_2.2.1-1_i386.deb) ...
Paramétrage de python-egenix-mxtools (3.1.3-4) ...
Traitement des actions différées (« triggers ») pour « python-central »...
Paramétrage de python-egenix-mxdatetime (3.1.3-4) ...
Traitement des actions différées (« triggers ») pour « python-central »...
Paramétrage de python-psycopg2 (2.2.1-1) ...
Traitement des actions différées (« triggers ») pour « python-central »...
2 — Installer virtualenv
root@pat762x:/home/alioune# pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.9.1.tar.gz (2.0MB): 2.0MB downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*' found under
directory 'docs/_templates'
warning: no previously-included files matching '*' found under
directory 'docs/_build'
Installing collected packages: virtualenv
Running setup.py install for virtualenv
warning: no previously-included files matching '*' found under
directory 'docs/_templates'
warning: no previously-included files matching '*' found under
directory 'docs/_build'
Installing virtualenv script to /usr/local/bin
Installing virtualenv-2.6 script to /usr/local/bin
Successfully installed virtualenv
Cleaning up...
3 — Creer ve (Virtual environnment)
root@pat762x:/home/alioune# virtualenv --system-site-packages ve
New python executable in ve/bin/python
Installing setuptools............done.
Installing pip...............done.
root@pat762x:/home/alioune#
root@pat762x:/home/alioune#
--Test
root@pat762x:/home/alioune# cd ve/
root@pat762x:/home/alioune/ve# python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> import psycopg2.extensions
4 — Install Django 1.5
root@pat762x:/home/alioune/ve# pip install django
Downloading Django-1.5.tar.gz (8.0MB): 15% 1.2MB
Downloading Django-1.5.tar.gz (8.0MB): 8.0MB downloaded
Running setup.py egg_info for package django
warning: no previously-included files matching '__pycache__' found
under directory '*'
warning: no previously-included files matching '*.py[co]' found
under directory '*'
Installing collected packages: django
Running setup.py install for django
changing mode of build/scripts-2.6/django-admin.py from 644 to 755
warning: no previously-included files matching '__pycache__' found
under directory '*'
warning: no previously-included files matching '*.py[co]' found
under directory '*'
changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed django
--Test
root@pat762x:/home/alioune/ve# python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'1.5'
5 — Starting new Project
root@pat762x:/home/alioune/ve# django-admin.py startproject myProject
root@pat762x:/home/alioune/ve#
root@pat762x:/home/alioune/ve/myProject/myProject# ls
__init__.py __init__.pyc settings.py settings.pyc urls.py wsgi.py
python manage.py startapp myapp
root@pat762x:/home/alioune/ve/myProject/myapp# ls
__init__.py __init__.pyc myapp settings.py settings.pyc urls.py wsgi.py
6 — Chager le postgresql_psycopg2 engine
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
# Add 'postgresql_psycopg2',
#'mysql', 'sqlite3' or 'oracle'.
'NAME': 'test', # Or path to database
file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'test',
'PASSWORD': 'test',
'HOST': '', # Empty for localhost
#through domain sockets or '127.0.0.1' for localhost
through TCP.
'PORT': '', # Set to empty string for default.
}
}
et il dit
root@pat762x:/home/alioune/ve/myProject# python manage.py syncdb
ImproperlyConfigured: settings.DATABASES is improperly configured.
Please supply the NAME value.
7 — Intaller postgresql
sudo aptitude install postgresql
root@pat762x:/etc/init.d# aptitude install postgresql
Les NOUVEAUX paquets suivants vont être installés :
postgresql postgresql-8.4{a} postgresql-common{a}
Les paquets suivants seront mis à jour :
postgresql-client-common
Les paquets suivants sont RECOMMANDÉS mais ne seront pas installés :
lsb-release
1 paquets mis à jour, 3 nouvellement installés, 0 à enlever et 92 non
mis à jour.
Il est nécessaire de télécharger 5 801 ko/5 833 ko d'archives. Après
dépaquetage,
16,5 Mo seront utilisés.
Voulez-vous continuer ? [Y/n/?] Y
Prendre : 1 http://security.debian.org/ squeeze/updates/main
postgresql-8.4 i386
8.4.16-0squeeze1 [5 620 kB]
Prendre : 2 http://ftp.fr.debian.org/debian/ squeeze/main
postgresql-client-common all
113+squeeze1 [55,2 kB]
Prendre : 3 http://ftp.fr.debian.org/debian/ squeeze/main
postgresql-common all 113+squeeze1 [126 kB]
5 801 ko téléchargés en 2min 36s (37,1 ko/s)
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
postgres 4036 0.0 0.0 3952 1144 pts/0 S 22:21 0:00 su - postgres
postgres 4037 0.0 0.1 6068 3424 pts/0 S 22:21 0:00 -su
postgres 4165 0.1 0.2 47056 5836 ? S 22:21 0:00
/usr/lib/postgresql/8.4/bin/postgres
-D /var/lib/postgresql/8.4/main -c
config_file=/etc/postgresql/8.4/main/postgresql.conf
postgres 4167 0.0 0.0 47192 1544 ? Ss 22:21 0:00
postgres: writer process
postgres 4168 0.0 0.0 47192 1316 ? Ss 22:21 0:00
postgres: wal writer process
8 — Creer 'mypguser' et 'mypgdatabase'
postgres@pat762x:~$ psql
psql (8.4.11, serveur 8.4.16)
Saisissez « help » pour l'aide.
postgres=#
postgres=# CREATE USER mypguser WITH PASSWORD 'mypguser';
CREATE
ROLE
postgres=# CREATE DATABASE mypgdatabase OWNER mypguser;
CREATE DATABASE
postgres=#
postgres=#
postgres@pat762x:~$ su - mypguser
Mot de passe :
mypguser@pat762x:~$ psql mypgdatabase
psql (8.4.11, serveur 8.4.16)
Saisissez « help » pour l'aide.
mypgdatabase=>
psql -d mypgdatabase -U mypguser
9 — JE Update le fichier settings.py de django avec mypguser , mypguserpass
mypgdatabase
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add
'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mypgdatabase', # Or path to
database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'mypguser',
'PASSWORD': 'mypguser',
'HOST': '', # Empty for localhost through
domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
10 — Enfin Je syncdb
mypguser@pat762x:/home/alioune/ve/myProject$ python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
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 'mypguser'): alioune
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
mypguser@pat762x:/home/alioune/ve/myProject$
—Ad
Le 20 mars 2013 22:24, Séno Hervé Edorh <[email protected]> a écrit :
> Et la je suis daccord,c'est l'install qui emmene des dépendances erronées.
> C'est pour ça que je disais ne pas comprendre cette histoire de python3.2
>
> On Mar 20, 2013 8:14 PM, "Patt Nsukami" <[email protected]> wrote:
>>
>> Erreur de sortie d'etat 1 montre que c'est dpkg qui n'avale pas un
>> truc. Le "EOFError: EOF read where not expected" ???
>> Soit il etait ds un etat incoherent avant que tu ne lances l'install,
>> soit c'est l'install qui amene des dependances incoherentes???
>> Désolé, mais là, je n'ai plus d'idées, heum... retourner sur
>> l'ancienne machine :)
>>
>> Le 20/03/13, Séno Hervé Edorh<[email protected]> a écrit :
>> > @thomas Sur la nouvel machine, je n'utilise pas virtualenv.
>> > Le pourquoi il a planté,je ne sais pas.sur le linux mint
>> > debian,l'application passe bien.
>> > Et pour les install,je fait exactement comme tu fais.
>> > On Mar 20, 2013 6:06 PM, "Thomas NOEL" <[email protected]> wrote:
>> >
>> >> Le 20 mars 2013 17:07, Séno Hervé Edorh <[email protected]> a écrit :
>> >> > @thomas au fait mon problème c'est pas pyhton3.2 (je ne l'ai
>> >> > installé),
>> >> je
>> >> > n'arrivais pas à installer psycopg2 et avec easy_install c'est passé.
>> >> quand
>> >> > je tente de me connecter via django j'ai ceci:
>> >> >> Error: No module named psycopg2.extensions
>> >>
>> >> Il faut que tu sois un peu plus précis, et surtout :
>> >> - pourquoi l'installation de "python-psycopg2" a planté : il s'agit du
>> >> module pour la famille python2, et donc ne rien avoir à faire avec
>> >> python2...
>> >> - est-ce que ton applicaiton Django tourne dans un virtualenv ? Si
>> >> oui, ton "easy_install", l'as-tu fait dans un virtualenv ?
>> >>
>> >> Ensuite, mes remarques/conseils :
>> >> - utilise pip au lieu d'easy_install
>> >> - si tu utilises des virtualenv, il faut les fabriquer avec l'option
>> >> "--system-site-packages" pour que les lib Python du systèmes y soient
>> >> visibles, sinon c'est chiant pour des trucs comme psycopg
>> >>
>> >> En général je fais des choses comme ça pour avoir un environnement de
>> >> dev tranquille :
>> >>
>> >> $ sudo apt-get install python-psycopg2
>> >> $ virtualenv --system-site-packages ve
>> >> $ cd ve ; $ . bin/activate
>> >> $ pip install django # pour avoir la 1.5 qui dépote
>> >> ... et c'est partiiiiii
>> >>
>> >> a++
>> >> --
>> >> Thomas
>> >>
>> >> --
>> >> Ce message a été envoyé à la liste [email protected]
>> >> Gestion de votre abonnement : http://dakarlug.org/liste
>> >> Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug
>> >> Le site du DakarLUG : http://dakarlug.org
>> >>
>> >
>>
>>
>> --
>>
>> Sincerely,
>>
>> "still water is deep"
>> Patrick Nsukami, Python/Java web developer
>> twitter: @LeMeteore
>> phone: +221 70 605 15 88
>>
>> --
>> Ce message a été envoyé à la liste [email protected]
>> Gestion de votre abonnement : http://dakarlug.org/liste
>> Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug
>> Le site du DakarLUG : http://dakarlug.org
>
>
>
> --
> Ce message a été envoyé à la liste [email protected]
> Gestion de votre abonnement : http://dakarlug.org/liste
> Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug
> Le site du DakarLUG : http://dakarlug.org
--
Ce message a été envoyé à la liste [email protected]
Gestion de votre abonnement : http://dakarlug.org/liste
Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug
Le site du DakarLUG : http://dakarlug.org