Modifications entre les versions 1 et 11 (s'étendant sur 10 versions)
Version 1 à la date du 2010-02-17 21:50:39
Taille: 742
Éditeur: MoussaNombre
Commentaire:
Version 11 à la date du 2010-10-04 14:02:40
Taille: 7868
Commentaire:
Texte supprimé. Texte ajouté.
Ligne 1: Ligne 1:
= Dépôt pypi de l'AUF avec CHISHOP =

== Le serveur ==
<<TableOfContents()>>

= Dépôt pypi de l'AUF (django-chishop) =

== Composants Tiers ==

Le pypi de l'AUF contient des releases connexes de modules dévelopés par d'autres personnes. Cela permet de fournir des releases "spécial AUF" en attendant que les changements soient reportés dans le projet initial.

[[Liste des composants tiers]]

== Utilisation ==

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.

=== 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 ===
Ligne 9: Ligne 76:
== Installation / Configuration ==

 * Documentation et téléchargement :    * http://pypi.python.org/pypi/chishop/0.2.0
=== Configuration ===

 * Documentation et téléchargement :
Ligne 14: Ligne 80:

 * 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 19: Ligne 86:
  * auf_roa_authentification_backend + un buildout (fait par Cyril)   * 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 24: Ligne 216:
    $ python setup.py build
    # python setup.py install (en root)
    $ python bootstrap.py
    # bin/buildout
    # bin/django syncdb
Ligne 27: Ligne 220:

 * 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 30: Ligne 242:
    $ cd chipshop/
    $
   ...
    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
  }}}

Dépôt pypi de l'AUF (django-chishop)

Composants Tiers

Le pypi de l'AUF contient des releases connexes de modules dévelopés par d'autres personnes. Cela permet de fournir des releases "spécial AUF" en attendant que les changements soient reportés dans le projet initial.

Liste des composants tiers

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

Python/DépôtPypi (dernière édition le 2010-10-04 14:02:40 par OlivierLarchevêque)