8000 GitHub - agutteridge/codefirstgirls: Example for deploying a simple Flask/python2.7 application to Heroku
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.

agutteridge/codefirstgirls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeFirst:Girls Deployment Guide

Introduction

What is deploying? This is a technical word for releasing your software out into the world! Instead of running your Flask webserver on localhost, you'll be able to get the code running on a machine and accessible from anywhere with an internet connection.

Example Application

This repository contains the config files you'll need to deploy to Heroku. Don't copy and paste yet! We'll do that later.

Go to http://damp-meadow-68595.herokuapp.com/ (sorry, the name was generated...) and compare it to the routes and templates in this repository. Can you see when each HTML file is used?

Guide

Only one person needs to do this per team. If you'd like to share an account, pick a password you can both use!

  1. Go to heroku.com and create an account
  2. Install the Heroku Command Line Interface
  3. cd to the project folder in your terminal. Make sure you have a git repository pointing to this already, and if not create a repository!
  4. Type heroku login and follow the instructions
  5. Make sure you've pushed all of your changes to your normal git repository.
  6. Copy the following files from this repository:
  1. Change the line that starts with module= in uwsgi.ini to reflect your project. In this example, the filename, and to python this is the module name is deploytest, and the app name is app.
  2. You can use the requirements.txt in this project, however if you've done a pip install for anything else then run pip freeze > requirements.txt in your terminal to grab all the packages you've installed, and overwrite this file. This tells the server to install anything extra that it needs from pip.
  3. In your main python file, make sure that you don't run the app when you're not executing the file, e.g.
if __name__ == '__main__':
    app.run(debug=True)
# NOT app.run(debug=True) on its own!
  1. Almost there! Run git push heroku in the terminal. This pushes your code to Heroku, which will apply the changes to your (hopefully running) server.
  2. Run heroku open as a shortcut to open your webpage in a browser. If there are errors, run heroku logs --tail to have a look.

Push to GitHub, push to Heroku

Every time you make a change, the commands you run will be as follows:

# the dot means add all changed files
git add .
git commit -m "Your message here"
# push to GitHub
git push
# push to Heroku
git push heroku

About

Example for deploying a simple Flask/python2.7 application to Heroku

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
0