How to update Flask apps to production server

This is my first question in stack overflow, i always found my answers here and now is time to ask on something that i can’t resolve.

I been searching on google about this but i couldnt resolve my problems.

  • Chef passing revision variable to deploy resource
  • Using Git to update production server
  • Checking out Git tag leads to “detached HEAD state”
  • How to connect to a taget server via SSH with a key from a GitLab pipeline?
  • How to provide access to a git repository that is used by Composer
  • How do you deploy a website to your webservers?
  • I want to create a project in python using Flask. I know how to setup the server to run the app, i’m using

    1. Ubuntu Server 12.04
    2. Apache
    3. Flask Python
    4. Digital Ocean Production Server
    5. Elementary OS for Development Computer

    I know how to configure the app following this tutorial on digital ocean

    I want to be “profesional” i came from PHP and normaly i used FTP to uploading my changes from my computer to the production server. Someone in my last job configured SVN as control version to update the production server.

    I need something similar for my project but i dont know how to do it. If i edited a .py file in my computer and upload the file via FTP the changes doesnt reflect in my browser. I have to restart apache o the entire server to see that changes, and of course thats not a clever way to work.

    I really need help to setup a workflow using git, the idea is simple. I’ll install git in my computer to work and git in my production server and i want to deploy and update the app using git and see the changes on the app (watching my browser) but my
    questions are

    how i can do this setup? and do i have to execute any command on my production server any time that i commit an update from my computer? or everything will be automaticaly with git.

    I’ll apreciate the answers and the help casue i’m discouraged and i dont want to back to PHP

  • Does Git publicly expose my e-mail address?
  • Push fails in GitKraken with errormessage “Push Failed cannot read property 'fullName' of undefined”
  • Git Svn clone certain revision, and continue cloning other revisions in the future
  • Reuse Swift Code between project, running framework code locally and via Carthage
  • Git-svn merge two SVN branches
  • What does this GIT command do?
  • 3 Solutions collect form web for “How to update Flask apps to production server”

    The short, general answer is that in Python you’d use a deployment tool, with a set of deployment scripts.

    Popular deployment tool choices for Python include Fabric and Paver. These tools essentially facilitate the creation of “task” scripts, which you can then run. They are geared towards deployment, so they provide library functions that execute actions on remote servers.

    Per your example, you can write a script for Fabric that would connect to the remote server, upload the code by SFTP, and restart your server gracefully.

    I strongly suggest investing the time to learn and use one of these tools. Beyond the obvious advantages, they have many non-obvious benefits for long term usage, for example: much easier to scale across multiple deployment target boxes.

    I am using the same configuration as you are (except I use Ubuntu 14.04) and found the following two tutorials extremely helpful. If I understand what you are asking, this should push you on your way:

    1. How to Set Up Automatic Deployment with Git on a VPS
    2. How to Deploy a Flask Application on an Ubuntu VPS

    You listed the second tutorial already, so the first one should show you how to set up git to push-deploy to your server. It also shows you how to set up a beta branch in case you don’t want to push to prod right away!

    Not a complete solution, but take a look at gitreceive. This is a small bash script that you run on your production server to configure it to receive code via git push.

    I say it is not a complete solution because all gitreceive does is call a script that you have to write with the files that were pushed. Your script has to install the files, run any setup tasks, restart the server, etc.

    Git Baby is a git and github fan, let's start git clone.