• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    Python
  • Created almost 11 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bull always charges!

bull always charges...

Build Status Coverage Status

WTF is bull?

On a Friday evening, not too long ago, I was lamenting the shortcomings of the various services I've used to sell my digital book from my personal website. Digital goods sales should be a solved problem by now, but I ran into all sorts of issues when trying to send updates to customers and integrate properly with Google Analytics.

Long story short, I took two hours and wrote a replacement using Python, Flask, SQLAlchemy, and Stripe (as the payment processor). bull is to set up on your own domain. Why does the fact that bull runs on your own domain matter? Because it makes Google Analytics happy and report conversions properly.

The only things you need to get started using bull are a Stripe account (free) and a web server (free?).

Installation

  1. pip install bull. This installs the bull command, which helps setup your environment
  2. bull setup. This creates a directory named bull with the following contents:
    • app.py: the main application script. get_app can be used to run bull as a WSGI application
    • config.py: bull's configuration file. This must be edited to contain your installation-specific configuration details.
    • files directory: The directory that contains the files for your digital products
  3. Add product entries to the database (use scripts/populate_db as a model)
  4. (Optional) Create an admin user for viewing /reports by running scripts/create_user.py
  5. Add bull to your web server's configuration
  6. Profit! (...literally)

Analytics and Login

bull supports simple sales analytics at the /reports endpoint. It requires authorization, which in turn requires you to create (at least one) user using the scripts/create_user.py script. To see the reports, hit /login, log in, and from then on you can go directly to /reports to see reporting data. You should be good to go after that, and no one else will be able to see the reports.

If for some reason you need to logout, there is also a /logout endpoint which will log you out (which should use HTTP POST instead of GET, but whatever).

Reporting includes:

  • Email addresses and sales totals of recent purchases
  • Sales data broken down by calendar day
  • Sales charts based on revenue/units sold per day

Overriding Default Templates

Simply create a templates directory and create a file of the same name as the template you want to replace.

Testing

bull has a (small) suite of tests that are run via TravisCI, but can (and should) also be tested manually once installed. Run python app.py and browse to http://localhost:5000/test/1. You should see a single "Buy" button, which should be completely functional (assuming you have at least one product in your database). Enter Stripe's test credit card number (4242 4242 4242 4242). You should be successfully directed to a "success.html" page with your download link. If your product is in the files directory, you'll be able to download it by clicking the link.

Deployment

Don't run app.py in production. The web server it uses is not meant for such a purpose. Instead, deploy as you would normally deploy an WSGI application. See Flask's documentation on the subject.

TODO

Still need to add better documentation and (possibly) deployment information. All of this is coming. I just wanted to get bull out as fast as possible so that those who know what they're doing can make use of it.

Bitdeli Badge

More Repositories

1

sandman

Sandman "makes things REST".
Python
2,311
star
2

sandman2

Automatically generate a RESTful API service for your legacy database. No code required!
Python
1,997
star
3

blug

Because "I just blogged about it" is too difficult to say.
CSS
158
star
4

omega

The Last Python Web Framework
Python
71
star
5

domain-parser

Parse domains using the TLD list maintained by publicsuffix.org
Python
61
star
6

brokest

Broker-less Python Task Queue
Python
53
star
7

blog

Repo for jeffknupp.com content
Python
43
star
8

flask_sandboy

Sandman's little brother
Python
42
star
9

review

Code for project reviews
Python
38
star
10

adserver

A simple ad server in Go
Go
16
star
11

presser

letterpress AI bot
Python
10
star
12

eavesdropper

JavaScript
10
star
13

sprime

sandman prime
Python
9
star
14

dotfiles

Shell
8
star
15

kickstarter_video_two

Code for the second video in the Writing Idiomatic Python Video Series
Python
6
star
16

talks

Talks I've given/am working on
HTML
6
star
17

python-data-structures

4
star
18

docker

Shell
4
star
19

kickstarter_video_three

Writing Idiomatic Python Video Three code
Python
4
star
20

monitord

Python
4
star
21

nosql

Toy NoSQL implementation for blog post
Python
4
star
22

jeffknupp

Personal repo just for the wiki-ness
3
star
23

python-docs

New documentation for the Python language
Python
2
star
24

jeffknupp.github.com

pages review
2
star
25

tutor_toph

2
star
26

proxy

HTTP traffic inspection
2
star
27

af

source code search tool modeled after ack/ag
Go
2
star
28

real_sharps

CSS
1
star
29

betterback

JavaScript
1
star
30

tutor_john

CSS
1
star
31

browser

Go
1
star
32

tutor_martin

1
star
33

sandman_new

Python
1
star
34

edp

Python
1
star
35

json_resume

Resume
1
star
36

sprite

A super-lightweight HTTP server in Go
Go
1
star
37

writing-idiomatic-python

Changes and errors in "Writing Idiomatic Python"
1
star
38

execd

Platform for executing distributed jobs
1
star