title: Deploying a python Flask application with Jenkins and executing it
body: <p>I am trying to do auto-deployment of a Python Flask application using Jenkins and then run it by using shell command on a Raspberry Pi server.</p>
  
  <p>Here are some <strong>background info</strong>,</p>
  
  <p>Before using Jenkins, my deployment and execution process was manual described below:</p>
  
  <ol>
  <li>FTP to the directory where my Python scripts and Python venv are located</li>
  <li>Replace Flask application scripts using FTP</li>
  <li>Activate virtual environment to of Python(3.5) through the terminal on Raspberry Pi ("./venv/bin/activate")</li>
  <li>Run myFlaskApp.py by executing "python myFlaskApp.py" in terminal</li>
  </ol>
  
  <p>Now I have integrated Jenkins with the deployment/execution process described below:</p>
  
  <ol>
  <li>Code change pushed to github</li>
  <li>Jenkins automatically pulls from github</li>
  <li>Jenkins deploy files to specified directories by executing shell commands</li>
  <li>Jenkins then activates virtual environment and run myFlaskApp.py by bashing a .sh script in the shell terminal.</li>
  </ol>
  
  <p>Now <strong>the problem</strong> that I am having is on step 4, because a Flask app has to always be alive, my Jenkins will never "finish building successfully", it will always be in a loading state as the Flask app is running on the shell terminal Jenkins is using.</p>
  
  <p>Now my <strong>question</strong>:
  What is the correct approach that I should be taking in order to activate myFlaskApp.py with Jenkins after deploying the files while not causing it to be "locked down" by the build process?</p>
  
  <p>I have read up about Docker, SubShell and the Linux utility "Screen". Will any of these tools be useful to assist me in my situation right now and which approach should I be taking?</p>