1447
Commentaire:
|
7585
|
Texte supprimé. | Texte ajouté. |
Ligne 3: | Ligne 3: |
= Dépôt pypi de l'AUF avec CHISHOP = | = Dépôt pypi de l'AUF (django-chishop) = |
Ligne 7: | Ligne 7: |
Requiert le paquet [[http://pypi.python.org/pypi/collective.dist|collective.dist]] La documentation de ce paquet fournit d'autres exemples en complément de ce document. |
|
Ligne 11: | Ligne 15: |
Modèle de {{{~/.pypirc}}}: | Exemple de {{{~/.pypirc}}}: |
Ligne 15: | Ligne 19: |
local | auf |
Ligne 18: | Ligne 22: |
[pypi] username:auf password:auf [local] |
[pypi] #pypi.python.org username:<compte pypi> password:<mot de passe> [auf] #pypi.auf.org |
Ligne 29: | Ligne 33: |
* On doit re-spécifier pypi, sinon il ne sera pas consulté du tout, et les sections username/password sont obligatoires (pour le fichier), mais on en aura rarement besoin. | * On doit re-spécifier pypi[.python.org], sinon il ne sera pas consulté du tout, et les sections username/password sont obligatoires (pour le fichier), mais on en aura rarement besoin. Une fois que le pypi de l'auf est configuré, on peut commencer a s'en servir. Quelques exemples: {{{ # Installer un module $ easy_install -f http://pypi.auf.org/media/dist/caldav-0.1.3.tar.gz # Publier un module $ python setup.py -r auf sdist upload }}} |
Ligne 33: | Ligne 50: |
Il faut ajouter l'url de base des dépendances: |
|
Ligne 36: | Ligne 55: |
find-links = http://pypi.auf.org/simple/ | find-links = http://pypi.auf.org/projet1/ http://pypi.auf.org/projet2/ |
Ligne 40: | Ligne 60: |
== Serveur == | == Installation / Configuration du serveur == |
Ligne 48: | Ligne 70: |
=== Installation / Configuration === * Documentation et téléchargement : |
=== Configuration === * Documentation et téléchargement : |
Ligne 52: | Ligne 74: |
* télécharger chishop (ici la version 0.2.0) |
* http://pypi.python.org/pypi/chishop * version utilisée : `git clone git://github.com/ask/chishop.git` |
Ligne 57: | Ligne 80: |
* auf_roa_authentification_backend * ajouter ''django_roa'' a l'option ''eggs'' dans ''buildout.cfg'' |
* on a dû re-installer le setuptools car la version Lenny est inférieure à celle requise : `easy_install -U setuptools` * système d'authentification : pypi.auf.org utilise authentification.auf.org ([[https://redmine.auf.org/projects/roa-authentification|auf_roa_authentification]]) * importer le module `auf_roa_authentification_backend` dans chishop (`/srv/chishop/auf_roa_authentification_backend`) * ajouter `django_roa` dans le `buildout` : {{{ ... [django] ... eggs = ${buildout:eggs} django_roa <=1.5 ... }}} * configurer chishop pour `auf_roa_authentification_backend` en modifiant le fichier `/srv/chishop/chishop/settings.py`. Le fichier en entier (pour avoir tout ce qu'on a ajouté/modifié) : {{{ # Django settings for djangopypi project. import os DEBUG=True AUTH_PASSWORD_REQUIRED=True TEMPLATE_DEBUG=True LOCAL_DEVELOPMENT=True LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/' DJANGOPYPI_RELEASE_UPLOAD_TO = 'dist' ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'mysql' DATABASE_NAME = '********' DATABASE_USER = '***********' DATABASE_PASSWORD = '****' DATABASE_HOST = '********************' DATABASE_PORT = '' # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/Chicago' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" #here = os.path.abspath(os.path.dirname(__file__)) #MEDIA_ROOT = os.path.join(here, 'media') MEDIA_ROOT = '/srv/chishop/chishop/media/' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '/media/' MEDIA_PREFIX = "/media/" # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/admin-media/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'w_#0r2hh)=!zbynb*gg&969@)sy#^-^ia3m*+sd4@lst$zyaxu' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) ROOT_URLCONF = 'chishop.urls' TEMPLATE_DIRS = ( '/srv/chishop/chishop/templates', # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'djangopypi', 'django_roa', 'auf_roa_authentification_backend', ) AUTHENTICATION_BACKENDS = ( 'auf_roa_authentification_backend.backends.CascadeBackend', ) ROA_MODELS = True # set to False if you'd like to develop/test locally ROA_FORMAT = 'django' ROA_HEADERS = { 'Content-Type': 'application/x-www-form-urlencoded', } ROA_DJANGO_ERRORS = True # useful to ease debugging if you use test server ROA_BASE_URL = 'url-du-serveur-auth' SERIALIZATION_MODULES = { 'django' : 'auf_roa_authentification_backend.serializers', } }}} |
Ligne 65: | Ligne 212: |
# bin/django syncdb | |
Ligne 66: | Ligne 214: |
* configuration : |
* on a modifié le `/srv/chishop/djangopypi/models.py` (en baissant la taille de certains champs) pour régler un soucis de taille de clé primaire supérieure à 1000 octet. {{{ ... class Release(models.Model): version = models.CharField(max_length=64) distribution = models.FileField(upload_to=UPLOAD_TO) md5_digest = models.CharField(max_length=255, blank=True) platform = models.CharField(max_length=128, blank=True) signature = models.CharField(max_length=128, blank=True) filetype = models.CharField(max_length=255, blank=True) pyversion = models.CharField(max_length=32, blank=True) project = models.ForeignKey(Project, related_name="releases") upload_time = models.DateTimeField(auto_now=True) class Meta: ... unique_together = ("project", "version", "platform", "distribution", "pyversion") # Ce cont ces champs dont la taille a été baissé plus haut ... }}} * configuration du virtual-host apache : |
Ligne 69: | Ligne 236: |
$ cd chishop/ $ |
... DocumentRoot /srv/chishop/chishop ... WSGIPassAuthorization On WSGIScriptAlias / /srv/chishop/bin/django.wsgi Alias /media /srv/chishop/chishop/media Alias /admin-media /srv/chishop/parts/django/django/contrib/admin/media |
Sommaire
Dépôt pypi de l'AUF (django-chishop)
Utilisation
Requiert le paquet collective.dist
La documentation de ce paquet fournit d'autres exemples en complément de ce document.
setuptools
Pour utiliser le depot avec setuptools, il faut créer un fichier de configuration pour l'utilisateur qui va exécuter ces commandes.
Exemple de ~/.pypirc:
[distutils] index-servers = auf pypi [pypi] #pypi.python.org username:<compte pypi> password:<mot de passe> [auf] #pypi.auf.org username:<compte auf> password:<mot de passe> repository:http://pypi.auf.org/
Notes:
- On doit re-spécifier pypi[.python.org], sinon il ne sera pas consulté du tout, et les sections username/password sont obligatoires (pour le fichier), mais on en aura rarement besoin.
Une fois que le pypi de l'auf est configuré, on peut commencer a s'en servir. Quelques exemples:
# Installer un module $ easy_install -f http://pypi.auf.org/media/dist/caldav-0.1.3.tar.gz # Publier un module $ python setup.py -r auf sdist upload
buildout
Il faut ajouter l'url de base des dépendances:
[buildout] find-links = http://pypi.auf.org/projet1/ http://pypi.auf.org/projet2/
Installation / Configuration du serveur
Le serveur
- machine hôte : vz-tech.ca.auf
- N° de CT : 507
- IP : 199.84.140.25
- fqdn : pypi.auf.org
Configuration
- Documentation et téléchargement :
version utilisée : git clone git://github.com/ask/chishop.git
- répertoire de base /srv/chishop
- prérequis :
aptitude install python-setuptools python-MySQLdb
on a dû re-installer le setuptools car la version Lenny est inférieure à celle requise : easy_install -U setuptools
système d'authentification : pypi.auf.org utilise authentification.auf.org (auf_roa_authentification)
importer le module auf_roa_authentification_backend dans chishop (/srv/chishop/auf_roa_authentification_backend)
ajouter django_roa dans le buildout :
... [django] ... eggs = ${buildout:eggs} django_roa <=1.5 ...
configurer chishop pour auf_roa_authentification_backend en modifiant le fichier /srv/chishop/chishop/settings.py. Le fichier en entier (pour avoir tout ce qu'on a ajouté/modifié) :
# Django settings for djangopypi project. import os DEBUG=True AUTH_PASSWORD_REQUIRED=True TEMPLATE_DEBUG=True LOCAL_DEVELOPMENT=True LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/' DJANGOPYPI_RELEASE_UPLOAD_TO = 'dist' ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'mysql' DATABASE_NAME = '********' DATABASE_USER = '***********' DATABASE_PASSWORD = '****' DATABASE_HOST = '********************' DATABASE_PORT = '' # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/Chicago' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" #here = os.path.abspath(os.path.dirname(__file__)) #MEDIA_ROOT = os.path.join(here, 'media') MEDIA_ROOT = '/srv/chishop/chishop/media/' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '/media/' MEDIA_PREFIX = "/media/" # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/admin-media/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'w_#0r2hh)=!zbynb*gg&969@)sy#^-^ia3m*+sd4@lst$zyaxu' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) ROOT_URLCONF = 'chishop.urls' TEMPLATE_DIRS = ( '/srv/chishop/chishop/templates', # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'djangopypi', 'django_roa', 'auf_roa_authentification_backend', ) AUTHENTICATION_BACKENDS = ( 'auf_roa_authentification_backend.backends.CascadeBackend', ) ROA_MODELS = True # set to False if you'd like to develop/test locally ROA_FORMAT = 'django' ROA_HEADERS = { 'Content-Type': 'application/x-www-form-urlencoded', } ROA_DJANGO_ERRORS = True # useful to ease debugging if you use test server ROA_BASE_URL = 'url-du-serveur-auth' SERIALIZATION_MODULES = { 'django' : 'auf_roa_authentification_backend.serializers', }
- installation :
$ cd /srv/chishop $ python bootstrap.py # bin/buildout # bin/django syncdb
on a modifié le /srv/chishop/djangopypi/models.py (en baissant la taille de certains champs) pour régler un soucis de taille de clé primaire supérieure à 1000 octet.
... class Release(models.Model): version = models.CharField(max_length=64) distribution = models.FileField(upload_to=UPLOAD_TO) md5_digest = models.CharField(max_length=255, blank=True) platform = models.CharField(max_length=128, blank=True) signature = models.CharField(max_length=128, blank=True) filetype = models.CharField(max_length=255, blank=True) pyversion = models.CharField(max_length=32, blank=True) project = models.ForeignKey(Project, related_name="releases") upload_time = models.DateTimeField(auto_now=True) class Meta: ... unique_together = ("project", "version", "platform", "distribution", "pyversion") # Ce cont ces champs dont la taille a été baissé plus haut ...
- configuration du virtual-host apache :
... DocumentRoot /srv/chishop/chishop ... WSGIPassAuthorization On WSGIScriptAlias / /srv/chishop/bin/django.wsgi Alias /media /srv/chishop/chishop/media Alias /admin-media /srv/chishop/parts/django/django/contrib/admin/media