Django
----------

# en tant que user grace ::

    grace@vm301:/srv/www/grace/prod/geobi-grace-django$ export DJANGO_SETTINGS_MODULE='grace.settings'
    grace@vm301:/srv/www/grace/prod/geobi-grace-django$ bin/django-admin syncdb
    /srv/www/grace/prod/geobi-grace-django/grace/content/models.py:8: DeprecationWarning: Using short names for extensions has been deprecated and will be removed in FeinCMS v1.8. Please provide the full python path to the extension titles instead (feincms.module.page.extensions.titles).
      Page.register_extensions('titles')
    Syncing...
    Creating tables ...
    Creating table auth_permission
    Creating table auth_group_permissions
    Creating table auth_group
    Creating table auth_user_user_permissions
    Creating table auth_user_groups
    Creating table auth_user
    Creating table auth_message
    Creating table django_content_type
    Creating table django_session
    Creating table django_site
    Creating table django_admin_log
    Creating table registration_registrationprofile
    Creating table notification_noticetype
    Creating table notification_noticesetting
    Creating table notification_notice
    Creating table notification_noticequeuebatch
    Creating table notification_observeditem
    Creating table avatar_avatar
    Creating table south_migrationhistory
    Creating table page_page
    Creating table page_page_richtextcontent
    Creating table page_page_imagecontent
    Creating table page_page_videocontent
    Creating table thumbnail_kvstore
    Creating table contact_form_feedback
    Creating table adminfiles_fileupload
    Creating table adminfiles_fileuploadreference
    Creating table core_objectrole_permissions
    Creating table core_objectrole
    Creating table core_userobjectrolemapping
    Creating table core_groupobjectrolemapping
    Creating table core_genericobjectrolemapping
    Creating table maps_contact
    Creating table maps_layer
    Creating table maps_map
    Creating table maps_maplayer
    Creating table maps_role_permissions
    Creating table maps_role
    Creating table maps_contactrole
    Creating table analyse_analyse

    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 'grace'): admin
    E-mail address: jpc@makina-corpus.com
    Password: 
    Password (again): 
    Error: Your passwords didn't match.
    Password: 
    Password (again): 
    Superuser created successfully.
    Installing custom SQL ...
    Installing indexes ...
    Installed 10 object(s) from 1 fixture(s)

    Synced:
     > django.contrib.auth
     > django.contrib.contenttypes
     > django.contrib.sessions
     > django.contrib.sites
     > django.contrib.messages
     > django.contrib.gis
     > django.contrib.staticfiles
     > django.contrib.admin
     > django.contrib.sitemaps
     > django_extensions
     > registration
     > notification
     > avatar
     > south
     > mptt
     > feincms
     > feincms.module.page
     > sorl.thumbnail
     > pure_pagination
     > floppyforms
     > contact_form
     > adminfiles
     > templatetag_handlebars
     > math_captcha
     > geonode.core
     > geonode.maps
     > grace.carto
     > grace.history
     > grace.analyse

    Not synced (use migrations):
     - djcelery
     - pybb
     - grace.processing_file
     - grace.mobile
     - grace.content
     - grace.authent
    (use ./manage.py migrate to migrate these)


    grace@vm301:/srv/www/grace/prod/geobi-grace-django$ bin/django-admin migrate


Création répertoires
-----------------------
::
    mkdir -p /srv/www/grace/var/www/grace
    mkdir -p /srv/www/grace/static/
    mkdir -p /srv/www/grace/uploaded/


    root@vm301:/srv/www/grace# chmod -R 775 uploaded/                                                
    root@vm301:/srv/www/grace# chown -R grace:www-data uploaded/




Ajout d'un user par défaut dans l'interface
---------------------------------------------
::

    >>> from django.contrib.auth.models import User
    >>> u = User.objects.get(id = 1)

    >>> from grace.authent.models import UserProfile
    >>> zm = UserProfile.objects.get(user = u)

    >>> zm.language
    u'Fran\xe7ais'
    >>> zm.language = u'fr'
    >>> zm.save()




Change owner to geonode
--------------------------
::

    for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" grace` ; do  psql -c "alter table $tbl owner to geonode" grace ; done


Init.d rabbit-mq et celery 
------------------------------

modif du script d'init.d de rabbitmq-server qui n'est pas compatible.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
::

    root@vm301:/home/makina# cd /etc/init.d/

    vim rabbitmq-server

    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6


Install des cripts au démarage de la machine
++++++++++++++++++++++++++++++++++++++++++++++++++
::

    root@vm301:/etc/init.d# update-rc.d -f celeryd  defaults 99
    update-rc.d: using dependency based boot sequencing
    root@vm301:/etc/init.d# update-rc.d -f celeryev defaults 99
    update-rc.d: using dependency based boot sequencing
