[Gandi][Simple Hosting] Installation de Django 1.8
Python 2.7.6
1) Répertoire de travail :
[~] ➔ mkdir -p PYTHON/DJANGO/vhost/ [~] ➔ cd PYTHON/DJANGO/vhost/ [~/PYTHON/DJANGO/vhost] ➔
2) Clonage d’un exemple basique d’une application Django :
[~/PYTHON/DJANGO/vhost] ➔ git clone https://github.com/jpetazzo/django-on-gpaas.git default Clonage dans 'default'... remote: Counting objects: 47, done. remote: Compressing objects: 100% (30/30), done. remote: Total 47 (delta 9), reused 47 (delta 9), pack-reused 0 Unpacking objects: 100% (47/47), done. Vérification de la connectivité... fait. [~/PYTHON/DJANGO/vhost] ➔
3) Vérification :
[~/PYTHON/DJANGO/vhost] ➔ tree default/ default/ ├── Dockerfile ├── fig.yml ├── gandi.yml ├── paas.sh ├── project │ ├── db.sqlite3 │ ├── manage.py │ └── project │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-32.pyc │ │ ├── settings.cpython-32.pyc │ │ ├── urls.cpython-32.pyc │ │ └── wsgi.cpython-32.pyc │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── README.md ├── requirements.txt └── wsgi.py 3 directories, 17 files [~/PYTHON/DJANGO/vhost] ➔
4) Ajout du dépot distant Gandi :
[~/PYTHON/DJANGO/vhost] ➔ cd default/ [~/PYTHON/DJANGO/vhost/default] ➔ git remote add gandi git+ssh://6374694@git.dc0.gpaas.net/default.git [~/PYTHON/DJANGO/vhost/default] ➔ git remote show origin * distante origin URL de rapatriement : https://github.com/jpetazzo/django-on-gpaas.git URL push : https://github.com/jpetazzo/django-on-gpaas.git Branche HEAD : master Branche distante : master suivi Branche locale configurée pour 'git pull' : master fusionne avec la distante master Référence locale configurée pour 'git push' : master pousse vers master (à jour)
[~/PYTHON/DJANGO/vhost/default] ➔ git remote show gandi 6374694@git.dc0.gpaas.net's password: * distante gandi URL de rapatriement : git+ssh://6374694@git.dc0.gpaas.net/default.git URL push : git+ssh://6374694@git.dc0.gpaas.net/default.git Branche HEAD : (unknown)
[~/PYTHON/DJANGO/vhost/default] ➔ git remote -v gandi git+ssh://6374694@git.dc0.gpaas.net/default.git (fetch) gandi git+ssh://6374694@git.dc0.gpaas.net/default.git (push) origin https://github.com/jpetazzo/django-on-gpaas.git (fetch) origin https://github.com/jpetazzo/django-on-gpaas.git (push)
5) Pousser le code source de l’application vers Gitweb :
[~/PYTHON/DJANGO/vhost/default] ➔ git push -f gandi master 6374694@git.dc0.gpaas.net's password: Permission denied, please try again. 6374694@git.dc0.gpaas.net's password: Counting objects: 47, done. Delta compression using up to 2 threads. Compressing objects: 100% (39/39), done. Writing objects: 100% (47/47), 8.22 KiB | 0 bytes/s, done. Total 47 (delta 9), reused 0 (delta 0) To git+ssh://6374694@git.dc0.gpaas.net/default.git * [new branch] master -> master [~/PYTHON/DJANGO/vhost/default] ➔
6) Déploiement vers la production :
[~/PYTHON/DJANGO/vhost/default] ➔ ssh 6374694@git.dc0.gpaas.net "deploy default.git" 6374694@git.dc0.gpaas.net's password: initializing builder ....................builder ready Vm password: Grabbing terminal Ok -----> Starting new deployment (default - master) -----> Fetching application code -----> Building new application Using Python 3.2 Running virtualenv with interpreter /usr/bin/python3.2 New python executable in /tmp/build.4ZiTIfo6dX/local/bin/python3.2 Also creating executable in /tmp/build.4ZiTIfo6dX/local/bin/python Installing setuptools............done. ... project/project/__init__.py project/project/settings.py project/project/urls.py project/project/wsgi.py project/project/__pycache__/ project/project/__pycache__/__init__.cpython-32.pyc project/project/__pycache__/settings.cpython-32.pyc project/project/__pycache__/urls.cpython-32.pyc project/project/__pycache__/wsgi.cpython-32.pyc sent 13934 bytes received 366 bytes 28600.00 bytes/sec total size is 12688 speedup is 0.89 -----> Build complete -----> Cleaning temporary files
7) Test :
http://b4bc43c4a6.url-de-test.ws/
8) Liens :
https://wiki.gandi.net/fr/simple/instance/python
https://github.com/jpetazzo/django-on-gpaas
http://www.kedfilms.com/article/5/
[…] https://wiki.gandi.net/fr/simple/instance/python#exemple_d_application_avec_flask https://github.com/pallets/flask/tree/master/examples/minitwit http://rockstarninja.tech/gandisimple-hosting-installation-de-django-1-8/ […]