Coder Social home page Coder Social logo

nivratti / flask-heroku-example Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 7.0 290 KB

Simple flask example with static files and media files to demonstrate heroku integration

License: Apache License 2.0

Python 15.70% CSS 8.96% HTML 75.34%
python heroku flask heroku-deployment herokuapp heroku-cli flask-web flask-example flask-demo flask-heroku

flask-heroku-example's Introduction

Deploy Your Flask Project To Heroku

This is an example repository that uses Flask and Gunicorn to deploy your project to Heroku. Demo app link

Fork The Repository

You should fork the repository and then clone it so you can manage your own repo and use this only as a template.

$ git clone https://github.com/your_username/flask-heroku-example.git

At this point you should be able to modify the Flask app app.py:

WARNING: If you change the file name (app.py) and the Flask app (app = Flask(__name__)) then remember to change Heroku's Procfile:

web: gunicorn <filename>:<app_name>

Login to Heroku account using Heroku CLI

$ heroku login

Create Your Heroku App

You can also leave your_app_name empty if you want Heroku to create a randomized name.

$ heroku create your_app_name
Creating app... done, ⬢ your_app_name
https://your_app_name.herokuapp.com/ | https://git.heroku.com/your_app_name.git

Deploy Your Project

Your project is going to be deploy using gunicorn as a web server using the Procfile and it will be detected as a Python project since it is declared in runtime.txt

  • Add necessary files and commit them
$ git add -A
$ git commit -am "finished flask project"
  • Push to Heroku
$ git push heroku master
-- SNIP --
remote: -----> Python app detected
remote: -----> Installing python-3.6.5
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 11.8.2…
remote:        Installing dependencies from Pipfile.lock (59a99c)…
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 53.9M
remote: -----> Launching...
remote:        Released v3
remote:        https://your_app_name.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/your_app_name.git
 * [new branch]      master -> master

That's it, you can visit your app now with heroku open.

flask-heroku-example's People

Contributors

nivratti avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.