Skip to content

🥕 A proof of concept for a deployable web app in Python — with extra docs.

License

Notifications You must be signed in to change notification settings

gonzalo-bulnes/kata-python-web-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Web App

A proof of concept for a deployable web app in Python.

Goals

  • learn what it takes to deploy a small we app to Heroku
  • get a feeling of how its files could be organized in Python
  • give a try to Flask

Usage

  • the application is configured with a given color
  • every time you visit the web page you get a different number and the color that was chosen

Development

Build Status Demo

# create a virtual environment (optional)
python -m venv venv # using Python 3, search for virtualenv for Python 2
# activate the virtual environment
./venv/bin/activate

# install the dependencies
pip install -r requirements.txt

# run the test suite
pytest -v

# pick a color, configure the application to use it
export COLOR=turquoise

# run the application locally
FLASK_APP=numbersandcolors.py python -m flask run # then visit http://127.0.0.1:5000

# make changes, contribute ideas, have fun!

# once you're done, deactivate the virtual environment
deactivate

Deployment to Heroku

Manual

# install the Heroku CLI, then:
heroku login -i

# intitial setup
heroku git:remote -a numbersandcolors # or any name you like

# to deploy:
git push heroku master
# to configure the app:
heroku set:config COLOR=turquoise

# then visit: https://numbersandcolors.herokuapp.com (or https://your-preferred-name.herokuapp.com)

Automatic

Press the button to deploy this app to your Heroku account! A free Heroku account should suffice.

Deploy

Notes

  • Remember to add any new dependency to requirements.txt with pip freeze! On Ubuntu (and other Debian systems) pip freeze > requirements.txt outputs some undue configuration. If that's the case for you, prefer: pip freeze | grep -v "pkg-resources" > requirements.txt.

Credits

The carrot emoji used as logo belongs to Google and was published under the Apache License v2.0 as part of Noto Emoji.

License

Documentation

Copyright (C) 2019 Gonzalo Bulnes Guilpain

Permission is granted to copy, distribute and/or modify this document under the terms
of the GNU Free Documentation License, Version 1.3 or any later version published by
the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts. A copy of the license can be found at
<http://www.gnu.org/copyleft/fdl.html>.

Code

Except for the contents of the doc/ directory, this code is in the public domain.

About

🥕 A proof of concept for a deployable web app in Python — with extra docs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages