# Deploy flask application

**URL:** <https://forum.ansible.com/t/deploy-flask-application/33755>\
**Category:** Ansible Project\
**Created:** [September 7, 2020, 4:35pm UTC](https://forum.ansible.com/t/deploy-flask-application/33755 "2020-09-07T16:35:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavithra\_Chellakumar](https://avatars.discourse-cdn.com/v4/letter/p/6f9a4e/32.png) [@Pavithra\_Chellakumar](https://forum.ansible.com/u/Pavithra_Chellakumar)\
**Post date:** [September 7, 2020, 4:35pm UTC](https://forum.ansible.com/t/deploy-flask-application/33755/1 "2020-09-07T16:35:40Z")

</div>

How to deploy python-flask application using ansible?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 7, 2020, 6:12pm UTC](https://forum.ansible.com/t/deploy-flask-application/33755/2 "2020-09-07T18:12:51Z")

</div>

How do you deploy it now (without ansible)?

---

<div class="post-metadata">

**Author:** ![Sudheer\_S1](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@Sudheer\_S1](https://forum.ansible.com/u/Sudheer_S1)\
**Post date:** [September 8, 2020, 5:42am UTC](https://forum.ansible.com/t/deploy-flask-application/33755/3 "2020-09-08T05:42:58Z")

</div>

> How to deploy python-flask application using ansible?

There are many ways to do it. First you have to define the steps. Then use Ansible to carry out those steps or tasks.

Here's how I do it. I have written a generic role to deploy Flask apps. I have a playbook that executes the role.

1. Check out the Git repository to a source directory

2. Copy the source files to destination directory

3. Update/install Python packages in the virtual environment

4. Run DB migrations

5. Run some CLI commands

6. Restart systemd units

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [September 8, 2020, 7:24am UTC](https://forum.ansible.com/t/deploy-flask-application/33755/4 "2020-09-08T07:24:52Z")

</div>

Take a look at this already available role - [https://github.com/vitalk/ansible-flaskapp](https://github.com/vitalk/ansible-flaskapp). You might want to change as per your environment.
