Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pattu777/Ansible-Django
Ansible playbooks to deploy a Django project
https://github.com/pattu777/Ansible-Django
Last synced: 13 days ago
JSON representation
Ansible playbooks to deploy a Django project
- Host: GitHub
- URL: https://github.com/pattu777/Ansible-Django
- Owner: pattu777
- License: mit
- Created: 2016-06-21T14:05:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-02T16:47:09.000Z (over 8 years ago)
- Last Synced: 2024-08-01T22:54:31.051Z (3 months ago)
- Homepage:
- Size: 12.7 KB
- Stars: 7
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![](http://i.imgur.com/5QG0kVa.jpg?1)
# Ansible-Django
Ansible playbooks used to deploy a Django project on a remote server. This playbook assumes the remote server to be debian based. I used it to deploy [https://github.com/pattu777/LearningDjango](https://github.com/pattu777/LearningDjango) project on a Digital Ocean droplet.Also checkout my post [http://www.chinmayapatanaik.com/2016/06/25/Ansible-Django/](http://www.chinmayapatanaik.com/2016/06/25/Ansible-Django/) for more detailed description.
# Prerequisites
* Ansible installed on your local system.
* Passwordless setup for a user with sudo privilleges.
* A Django project copied onto the remote server.
* For simplicity I am using SQLite as my back-end database.
* A custom domain pointing to your cloud server(Optional). This domain name is used while setting up Nginx.# Tasks
* Install necessary packages.
* System packages
* Python packages
* Setup Django.
* Create a virtualenv.
* Install packages from requirements.txt file.
* Create db models.
* Collect static files.
* Setup Gunicorn.
* Customize the conf file.
* Copy the gunicorn.conf file to the remote server.
* Restart gunicorn server.
* Setup Nginx.
* Customize the Nginx conf file.
* Copy the Nginx config file to the remote server.
* Restart Nginx server.# Developing
Clone the repo. Make sure the prerequisities are met.
* Modify ansible.cfg.
* Provide IP address in hosts file.Finally run the playbook as shown below.
```bash
$ git clone --recursive [email protected]:pattu777/Ansible-Django.git
$ cd Ansible-Django
$ ansible-playbook -s deploy.yml
```# TODO
* A new role for setting up data stores like MySQL, Postgres etc.
* Check how to run the playbook in sudo mode through ansible.cfg
* Clone a Git repository instead of assuming it's already present on the remote serverFinally go to your domain and see your django app working.