Installation de Django 1.6 avec Python 3.2

Installation de Django 1.6 avec Python 3.2
Distribution : Debian 7 32 bits
1) Installation de Python 3.2 :

admin@server07py:~$ python --version
Python 2.7.3

2) Mise-à-jour du système :

root@server07py:~# apt-get update && apt-get upgrade

3) Installation de pip et de virtualenv :

root@server05:~# apt-get install python3-pip
root@server05:~# pip-3.2 install virtualenv

4) Ajouter un nouvel utilisateur :

root@server05:~# adduser util01
root@server05:~# su util01
util01@server05:/root$ cd
util01@server05:~$

5) Création d’un projet :

util01@server05:~$ mkdir projet1
util01@server05:~$ cd projet1/
util01@server05:~/projet1$ virtualenv newenv
New python executable in newenv/bin/python3.2
Also creating executable in newenv/bin/python
Installing setuptools, pip, wheel...done.

6) Activer le projet :

util01@server05:~/projet1$ source newenv/bin/activate
(newenv)util01@server05:~/projet1$

7) Installation de Django 1.5 :

(newenv)util01@server05:~/projet1$ pip install django=="1.5"
Collecting django==1.5
  Downloading Django-1.5.tar.gz (8.0MB)
    100% |################################| 8.0MB 20kB/s
Building wheels for collected packages: django
  Running setup.py bdist_wheel for django
  Stored in directory: /home/util01/.cache/pip/wheels/55/c3/87/103b3440c7837f291f6451ff3ff830f3d8929c0aee09e30c4a
Successfully built django
Installing collected packages: django
Successfully installed django-1.5
(newenv)util01@server05:~/projet1$

8) Vérification de la version :

(newenv)util01@server05:~/projet1$ django-admin.py --version
1.5
(newenv)util01@server05:~/projet1$ python
Python 3.2.3 (default, Feb 20 2013, 17:02:41)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'1.5'

9) Mise-à-jour de Django en 1.6 :

(newenv)util01@server05:~/projet1$ pip install django=="1.6" --upgrade
Collecting django==1.6
  Downloading Django-1.6-py2.py3-none-any.whl (6.7MB)
    100% |################################| 6.7MB 44kB/s
Installing collected packages: django
  Found existing installation: Django 1.5
    Uninstalling Django-1.5:
      Successfully uninstalled Django-1.5
Successfully installed django-1.6

10) Création d’un projet :

(newenv)util01@server05:~/projet1$ django-admin.py startproject emailtest
(newenv)util01@server05:~/projet1$ ls -l emailtest/
total 8
drwxr-xr-x 2 util01 util01 4096 Dec 22 21:26 emailtest
-rwxr-xr-x 1 util01 util01  252 Dec 22 21:26 manage.py
(newenv)util01@server05:~/projet1$ cd emailtest/
(newenv)util01@server05:~/projet1/emailtest$

11) Initialisation de la base de données Sqlite :

(newenv)util01@server05:~/projet1/emailtest$ python manage.py syncdb
Creating tables ...
Creating table django_admin_log
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
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 'util01'):
Email address: util01@test.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
(newenv)util01@server05:~/projet1/emailtest$

12) Lancement du serveur :

(newenv)util01@server05:~/projet1/emailtest$ python manage.py runserver 0.0.0.0:8000
Validating models...
0 errors found
December 22, 2015 - 20:30:34
Django version 1.6, using settings 'emailtest.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

13) Teste du serveur :
http://92.243.29.47:8000/
14) Désactivation de l’environnement :

(newenv)util01@server05:~/projet1/emailtest$ deactivate
util01@server05:~/projet1/emailtest$

15) Lien :
https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-ubuntu-14-04

Comments are closed, but trackbacks and pingbacks are open.