Git Product home page Git Product logo

pies's Introduction

Delicious Pies: A sample Flask app to practice analytics on

Home page of the app

To build your own app, first clone this repo somewhere and cd into it.

git clone https://github.com/timabe/pies
cd pies

Next you'll create a python virtual environment and install the requirements

pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Testing and Running Locally

First create the local database and add the Pies menu

python manage.py shell
>>> db.create_all()
>>> Pies.add_menu()
>>> quit()

Now you can run and play around with the functionality. Just run python manage.py runserver and navigate to http://127.0.0.1:5000/ or localhost:5000 in a browser.

Deploying with Heroku

Sign up for a free Heroku account if you don't have one. Once you've done that, download their command line tools.

Log into your account in a terminal window.

# log in and enter credentials
heroku login
# create an app. This creates the URL and a git repo
heroku create <optional-name>
# add your db
heroku addons:add heroku-postgresql:hobby-dev
# set up some heroku environment vars
heroku config:set FLASK_CONFIG=heroku
heroku config:set SECRET_KEY=<your secret key>
# push your code to the remote heroku git repo
git push heroku master
# now you can deploy the app!
heroku run python manage.py deploy --make_menu --seed

Once you've run that, you should be able to visit the url they gave you, which should look something like this https://<app_name>.herokuapp.com and open up the application.

Cleaning up

If you want to delete the app just run heroku apps:destroy <YOUR APP NAME>

Thanks and Credit

I would not have been able to create this app without relying heavily on the Flask tutorials and books written by Miguel Grinberg. Most of the code in this app is forked from his wonderful tutorial on building a microblogging service. For a great, comprehensive guide on building apps with the Flask framework, check out his tutorial and buy his O'Reily book, they are both great.

pies's People

Contributors

timabe avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

pies's Issues

Track Google Optimize experiment in Segment

Putting this snippet here so I remember it later.
<h1>Welcome! Please <a href="{{ url_for('auth.register') }}" onclick="analytics.track('Main Sign up Clicked', { experiment_bucket: Object.values(gaData['UA-90640312-1'].experiments)[0], })">Sign Up </a>

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.