Code Monkey home page Code Monkey logo

hello_flask's Introduction

hello_flask

flask hello world application

Steps to deploy a static Flask website to Heroku

  1. Create an account on www.heroku.com if you don't have one already.
  2. Download and install Heroku Toolbelt from www.toolbelt.heroku.com/
  3. Install gunicorn with "pip install gunicorn". Make sure you're using pip from your virtual environment if you have one.
  4. Create a requirement.txt file in the main app directory where the main Python app file is located. You can create that file by running "pip freeze > requirements.txt" in the command line. Make sure you're using pip from your virtual environment if you have one. The requirement.txt file should now contain a list of Python packages.
  5. Create a file named "Procfile" in the main app directory. The file should not contain any extension. Then type in this line inside: "web: gunicorn script1:app" where "script1" should be replaced with the name of your Python script and "app" with the name of the variable holding your Flask app.
  6. Create a runtime.txt file in the main app directory and type "python-3.5.1" inside. If you're using Python 2, you may want to type in "python-2.7.11" instead.
  7. Open your computer terminal/command line to point to the directory where the Python file containing your app code is located.
  8. Using the terminal, log in to Heroku with "heroku login"
  9. Enter your Heroku email address
  10. Enter your Heroku password
  11. Create a new Heroku app with "heroku create myawesomeappname"
  12. Initialize a local git repository with "git init"
  13. Add your local application files to git with "git add ."
  14. Tell git your email address with "git config --global user.email "[email protected]"". Make sure the email address is inside quotes here.
  15. Tell git your username (just pick whatever username) with "git config --global user.name "whateverusername"". The username should be in quotes.
  16. Commit the changes with "git commit -m "first commit"". Make sure "first commit" is inside quotes.
  17. Before pushing the changes to Heroku, tell heroku the name of the app you want to use with heroku "git:remote --app myawesomeappname"
  18. Push the changes to Heroku with "git push heroku master"
  19. That should do it. Go ahead and open your app with "heroku open".

hello_flask's People

Contributors

skycc86 avatar

Watchers

James Cloos 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.