{"id":24941389,"url":"https://github.com/wtower/ansible-django-deploy","last_synced_at":"2026-04-25T16:33:22.113Z","repository":{"id":68184785,"uuid":"51523437","full_name":"Wtower/ansible-django-deploy","owner":"Wtower","description":"Ansible role to deploy a Django app to Plesk.","archived":false,"fork":false,"pushed_at":"2019-01-25T09:51:48.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T17:48:47.762Z","etag":null,"topics":["ansible-role","deployment","django","mod-wsgi","plesk","virtualenv"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wtower.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-11T15:21:04.000Z","updated_at":"2019-01-25T09:00:07.000Z","dependencies_parsed_at":"2023-04-19T11:47:24.561Z","dependency_job_id":null,"html_url":"https://github.com/Wtower/ansible-django-deploy","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Wtower/ansible-django-deploy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wtower%2Fansible-django-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wtower%2Fansible-django-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wtower%2Fansible-django-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wtower%2Fansible-django-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wtower","download_url":"https://codeload.github.com/Wtower/ansible-django-deploy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wtower%2Fansible-django-deploy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32269458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible-role","deployment","django","mod-wsgi","plesk","virtualenv"],"created_at":"2025-02-02T18:22:33.246Z","updated_at":"2026-04-25T16:33:22.090Z","avatar_url":"https://github.com/Wtower.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"django-deploy\n=============\n\nAnsible role to deploy a Django app to Plesk.\n\nAdd the role `django-deploy`.\n\nRequired variables \n------------------\n\n(passed as extra variables):\n\n- `project`: **Django project name**, will also be used as virtualenv name.\n\nOptional variables\n------------------\n\n(passed as extra variables):\n\n- `loaddata`: Set to `true` in order to load data from `conf.data`.\n- `flush`: Set to `true` in order to flush data before `loaddata`. Depends on `loaddata` variable to be `true`.\n- `newrelic`: New Relic license key. Omit to skip New Relic. Recommended to add a default in playbook.\n- `exclude`: Additional pattern to exclude from sync, eg. `media/`.\n- `loglevel`: Explicitly define an Apache log level, eg. `loglevel=info`.\n\nRequired Configuration variables \n--------------------------------\n\n(better to keep in configuration file as shown in examples):\n\n- `conf`: A dictionary to help organize variables, containing:\n- `conf.app_name`: The application name (human description), used in New Relic too.\n- `conf.domain_name`: Domain name to be used in Apache conf. Omit to skip configure Apache in Plesk.\n- `conf.dev_path`: The local path of the project, eg ~/workspace/python/myproject.\n- `conf.host_path`: The remote path, where the wsgi index script lies, eg /var/www/vhosts/subscription/domain.\n- `conf.host_user`: The remote user to whom to transfer ownership after operations.\n- `conf.vhost_conf_path`: The remote path, where the apache configuration override (`vhost.conf`) is located.\n\nOptional Configuration variables\n--------------------------------\n\n- `conf.name`: The application name (machine name), the same as the Python app. Default: `{{ project }}`\n- `conf.python_version`: The python version to install (major.minor), default: `3.5`.\n- `conf.virtualenv_dir`: Virtualenvs home directory, default to vars' respective option.\n- `conf.compile_msgs`: Set to `true` in order to compile i18n messages.\n- `conf.memcached`: Set to `true` in order to clear cache.\n- `conf.data`: A list of the dump files to load data from, eg `[project, auth]`, omit to skip loaddata. \n  Depends on `loaddata` variable to be `true`.\n- `conf.limit_request_body`: The maximum upload size allowed to Apache. Default: 10MB.\n\n[WSGI](http://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIDaemonProcess.html)\n\n- `conf.wsgi_script`: The wsgi script, default: `index.wsgi`.\n- `conf.wsgi_threads`: If set mod_wsgi runs in daemon mode (**recommended** 3-25).\n\nThe following are used only for daemon mode:\n\n- `conf.wsgi_processes`: If set mod_wsgi runs in multi-process mode (integer).\n- `conf.wsgi_inactivity_timeout`: Set only for small traffic sites to reset process and reclaim memory (eg. 300).\n- `conf.wsgi_max_requests`: Set to let process restart after n seconds. Useful if process memory grows large.\n- `conf.wsgi_restart_interval`: Similar to the above. Only available for mod_wsgi\u003e=v4.5.12.\n- `conf.wsgi_graceful_timeout`: If any of the above two are set, the number of seconds to expect no requests to restart.\n- `conf.wsgi_queue_timeout`: If large request queues, drop requests after that many seconds.\n\nOther default variables\n-----------------------\n\n- `ansible_user_id`: The user id with access to mysql and mysql database.\n- `virtualenv_dir`: Virtualenvs home directory. Set to `false` to disable virtualenv. Default: `/var/virtualenvs`.\n- `django_settings`: The Django settings module (.py) to run manage.py from, default: `settings_live`.\n- `plesk_server_group`: Plesk server group, default: `psaserv`.\n- `plesk_account_group`: Plesk account group, default: `psacln`.\n- `sync_opts`: Additional options for rsync. Default: exclude `.*`.\n\nPlaybook examples\n-----------------\n\nSee the folder `examples/`:\n\n- `django_deploy.yml`: playbook example\n- `django_sites.yml`: configuration example\n\nTask description\n----------------\n\n1. Check that project path in dev as specified in configuration is valid and has wsgi script\n\n   Checks that there is a valid local path specified in `django_sites.yml` and an `index.wsgi` exists.\n   Avoids deploying wrong files.\n\n2. Check if gulp file exists\n\n   So that to execute next step.\n\n3. Execute gulp\n\n   Execute `gulp --production` locally.\n\n4. Set Python executable\n\n   Auxiliary task which sets a variable with the Python executable.\n\n5. Make virtualenv\n\n   Create a virtualenv if it does not exist.\n\n6. Check New Relic conf file in source\n\n   Otherwise create from template.\n\n7. Configure New Relic\n\n   If `newrelic` is defined configures New Relic.\n\n8. Open ownership\n\n   Open the target directory ownership to allow file copy.\n   \n9. Build sync options\n\n   Combine the default `sync_opts` variable with the `exclude` option.\n\n10. Sync files\n\n    Syncs files to target directory.\n\n    :warning: Make sure that you have synced back user uploaded files in `media` with manual `rsync` or use `exclude`. \n\n11. Upgrade pip\n\n    Upgrades pip, setup, wheel. \n\n12. Install pip requirements\n\n    Install `requirements.txt` in virtualenv.\n\n13. Set Django admin executable\n\n    Auxiliary task which sets a variable with the Django admin executable.\n\n14. Set Django admin settings\n\n    Auxiliary task which sets a variable with the custom settings file (default `django_settings` variable).\n\n15. Migrate\n\n    Runs migrations.\n\n16. Flush data\n\n    Flushes data if `loaddata` and `flush` are both true.\n\n17. Load data\n\n    Loads data if `loaddata` is true.\n\n18. Collect static\n\n    Runs collect static.\n\n19. Compile messages\n\n   Compiles i18n messages if `compile_msgs` is true.\n\n20. Clear cache\n\n   Clears cache if `memcached` is true.\n\n21. Post deployment script\n\n    Runs an optional `post_script`.\n\n22. Close ownership to Plesk account group\n\n    Reset target directory ownership to the appropriate Plesk permissions.\n\n23. Close ownership to Plesk server group\n\n    Reset target directory ownership to the appropriate Plesk permissions.\n\n24. Touch WSGI script\n\n    Update the timestamp. If WSGI daemon mode it causes restart of the process at next request.\n\n25. Configure Apache\n\n   Configure Apache to execute the wsgi script using the provided template file.\n   Only executes if a `domain_name` is provided.\n   If the configuration changes, causes Plesk to reconfigure the domain in the end (notifies handler).\n   If the configuration changes, causes Apache to restart in the end (notifies handler).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtower%2Fansible-django-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwtower%2Fansible-django-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtower%2Fansible-django-deploy/lists"}