Modifications entre les versions 6 et 7
Version 6 à la date du 2010-02-18 21:39:20
Taille: 6260
Éditeur: MoussaNombre
Commentaire:
Version 7 à la date du 2010-02-18 21:51:30
Taille: 6346
Éditeur: CyrilRobert
Commentaire:
Texte supprimé. Texte ajouté.
Ligne 34: Ligne 34:
Il faut ajouter l'url de base des dépendances:
Ligne 36: Ligne 38:
find-links = http://pypi.auf.org/simple/ find-links = http://pypi.auf.org/projet1/
    http://pyp
i.auf.org/projet2/

Dépôt pypi de l'AUF avec CHISHOP

Utilisation

setuptools

Pour utiliser le depot avec setuptools, il faut créer un fichier de configuration pour l'utilisateur qui va exécuter ces commandes.

Modèle de ~/.pypirc:

[distutils]
index-servers =
    auf
    pypi

[pypi]
username:auf
password:auf

[auf]
username:<compte auf>
password:<mot de passe>
repository:http://pypi.auf.org/

Notes:

  • 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.

buildout

Il faut ajouter l'url de base des dépendances:

[buildout]  
find-links = http://pypi.auf.org/projet1/
    http://pypi.auf.org/projet2/

Publier (setup.py)

$ python setup.py sdist upload -r auf

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.

  • 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)