Installation

Installation and requirements for django-ftp-deploy module

Requirements

  1. celery
  2. pycurl
  3. certifi
  4. django_braces
  5. django_crispy_forms

Required third party libraries are installed automatically if you use pip to install django-ftp-deploy.

Installation

Note

FTP Deploy Server is optional and doesn’t need to be installed for basic usage. It is however, highly recommended that you install FTP Deploy Server to gain full functionality.

  1. The recommended way to install the Django FTP Deploy is via pip:

    pip install django-ftp-deploy
    

    If you aren’t familiar with pip, download a copy of the ftp_deploy and add it to your Python path. You need to install all requirements manually as well.

  2. Add ftp_deploy and ftp_deploy.server to your INSTALLED_APPS setting:

    #settings.py
    
    INSTALLED_APPS = (
      ...
      'ftp_deploy',
      'ftp_deploy.server',
      ...
    )
    
  3. Make sure you have django.core.context_processors.request in your TEMPLATE_CONTEXT_PROCESSORS setting:

    #settings.py
    
    TEMPLATE_CONTEXT_PROCESSORS = (
      ...
      'django.core.context_processors.request',
      ...
    )
    
  4. Add the ftp_deploy URLs to your project URLconf as follows:

    #projectname/urls.py
    
    urlpatterns = patterns('',
        ...
        url(r'^ftpdeploy/', include('ftp_deploy.urls')),
        url(r'^ftpdeploy/', include('ftp_deploy.server.urls')),
        ...
      )
    
  5. Synchronize your database:

    python manage.py migrate ftp_deploy
    
  6. Copy static files into your STATIC_ROOT folder

    python manage.py collectstatic
    

Configuration

  • Add folder containing settings.py file to your Python path

  • Add DEPLOY_BITBUCKET_SETTINGS and/or DEPLOY_GITHUB_SETTINGS configuration to your settings:

    #settings.py
    
    DEPLOY_BITBUCKET_SETTINGS = {
      'username'      : '',
      'password'      : '',
    }
    
    DEPLOY_GITHUB_SETTINGS = {
      'username'      : '',
      'password'      : '',
    }
    
  • Set django_crispy_forms template pack to bootstrap 3

    #settings.py
    CRISPY_TEMPLATE_PACK = 'bootstrap3'
    
  • Add celery configuration:

    #settings.py
    BROKER_URL = ''
    CELERY_RESULT_BACKEND=''
    #settings depends on message broker and result backend, see example below
    
  • Go to your project root folder and run celery worker as follow:

    celery -A ftp_deploy worker --concurrency 1
    

    Note

    Celery example above apply only for development enviroment. Celery worker in production should be run as a deamon. Read more in Celery documentation.

    Warning

    Remember to include ‘–concurrency 1‘ option when running the worker. That avoid to perform more then one task at the same time.

Celery - RabbitMQ

If you are using Ubuntu or Debian install RabbitMQ by executing this command:

sudo apt-get install rabbitmq-server
  • Update celery configuration as follows:

    #settings.py
    BROKER_URL = 'amqp://'
    CELERY_RESULT_BACKEND='amqp'
    

Celery - django

Note

Configuration presented below use django as a broker and result backend, however this is not recommended for production enviroment. Read more in Celery documentation.

In order to use django as broker and backend, project need to have django-celery project installed:

  • Install django-celery using pip:

    pip install django-celery
    
  • Add djcelery to your INSTALLED_APPS setting

    #settings.py
    
    INSTALLED_APPS = (
      ...
      'kombu.transport.django',
      'djcelery',
      ...
    )
    
  • Update celery configuration as follows:

    #settings.py
    BROKER_URL = 'django://'
    CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend'
    
  • Synchronize your database:

    python manage.py migrate djcelery
    python manage.py migrate kombu.transport.django