Internal utilities

class dploi_fabric.utils.Configuration[source]

This class is the only correct source of information for this project. To reduce the amount of times config.ini is downloaded, it should always be used from utils.config, which is an instance of Configuration


takes a dict with environment variables and products a shell compatible export statement: ‘export PYTHONPATH=”stuff/here:more/here” USER=”mysite-dev”;’

defaults = {'sendfile': {}, 'supervisor': {'group_template': '/home/docs/checkouts/', 'celeryd_command_template': '/home/docs/checkouts/', 'template': '/home/docs/checkouts/', 'supervisord_command': None, 'celerycam_command_template': '/home/docs/checkouts/', 'use_global_supervisord': False, 'daemon_template': '/home/docs/checkouts/', 'gunicorn_command_template': '/home/docs/checkouts/', 'supervisorctl_command': None}, 'gunicorn': {'bind': None, 'workers': 2, 'maxrequests': 0, 'version': None, 'timeout': None}, 'nginx': {'client_max_body_size': '10m', 'enabled': True, 'template': '/home/docs/checkouts/'}, 'static': {}, 'newrelic': {'config_file': 'newrelic.ini', 'environment_name': '', 'enabled': False, 'license': ''}, 'environment': {}, 'processes': {}, 'checkout': {'tool': 'buildout'}, 'redis': {'appendonly': 'no', 'enabled': False, 'template': '/home/docs/checkouts/'}, 'django': {'cmd': 'bin/django', 'base': '.', 'args': [], 'append_settings': False}, 'celery': {'extra_options': '', 'celerycam': False, 'version': None, 'celerybeat': True, 'celerycam-frequency': 1.0, 'concurrency': 1, 'loglevel': 'WARNING', 'app': 'project', 'enabled': False, 'maxtasksperchild': 500}, 'logdir': None, 'memcached': {'enabled': True, 'size': 64}}

Default values for the configuration

deployment(site, env_dict)[source]

Here we add the information from and merge it into our site dictionaries. Can also be used to output warnings to the user, if he is using an old format.

django_manage(command, site='main')[source]

Wrapper around the commands to inject the correct pythonpath.

Example: django_manage(“migrate”), could result in

export PYTONPATH=/home/app-dev/app/; /home/app-dev/app/bin/python /home/app-dev/app/ migrate

load_sites(config_file_content=None, env_dict=None)[source]

Called from self.sites and returns a dictionary with the different sites and their individual settings.

processes(site, env_dict)[source]

Returns a dictionary of dictionaries each having the following keys:

  • command

    command to be run by supervisor

  • port

    port number,

  • socket

    path to unix socket

  • type