Skip to content

Instantly share code, notes, and snippets.

if ENVIRONMENT == 'dev':
APP_BASE_LINK = 'http://127.0.0.1:5000'
DEBUG = True
DEBUG_TOOLBAR = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'chishenma',
'HOST': 'localhost',
'PORT': '5432',
@MichelleGlauser
MichelleGlauser / gist:c0225076561f7e5d9946
Created May 9, 2014 00:12
Error after quitting local server
^CTraceback (most recent call last):
File "/Users/michelleglauser/.virtualenvs/venv/bin/envdir", line 8, in <module>
load_entry_point('envdir==0.6.1', 'console_scripts', 'envdir')()
File "/Users/michelleglauser/.virtualenvs/venv/lib/python2.7/site-packages/envdir/__init__.py", line 14, in run
go(runner.run, *args)
File "/Users/michelleglauser/.virtualenvs/venv/lib/python2.7/site-packages/envdir/__main__.py", line 12, in go
caller(args[0], *args[1:])
File "/Users/michelleglauser/.virtualenvs/venv/lib/python2.7/site-packages/envdir/runner.py", line 123, in run
self.terminate()
File "/Users/michelleglauser/.virtualenvs/venv/lib/python2.7/site-packages/envdir/runner.py", line 131, in terminate
@MichelleGlauser
MichelleGlauser / gist:8f40c75e5cd7a199ff55
Created June 5, 2015 19:46
Django StripeCouponView
# Stripe coupons!
class StripeCouponView(generic.View):
def get(self, request):
log.debug(request.GET)
coupon_code = request.GET.get('coupon', '')
api_url = 'https://api.stripe.com/v1/coupons/' + coupon_code
try:
r = requests.get(api_url, auth=(settings.STRIPE_SECRET_KEY, ''))
r.raise_for_status()
# models.py
def subscribe(self, plan, quantity=1, trial_days=None,
charge_immediately=True, prorate=djstripe_settings.PRORATION_POLICY, discount_code=None):
cu = self.stripe_customer
"""
Trial_days corresponds to the value specified by the selected plan
for the key trial_period_days.
"""
if ("trial_period_days" in djstripe_settings.PAYMENTS_PLANS[plan]):
class StripeCouponView(generic.View):
def get(self, request):
stripe.api_key=settings.STRIPE_SECRET_KEY
# coupon = stripe.Coupon.retrieve("ZANAFAMILY")
# print coupon
# log.debug(request.GET)
# # Saves the characters after "=" as coupon_code
# coupon_code = request.GET.get('coupon', '')
if "coupon" in request.GET:
coupon_code = request.GET['coupon']
@MichelleGlauser
MichelleGlauser / gist:997f16f1e29cc004d8ff
Last active August 29, 2015 14:22
Zana Stripe Subscribe Form
{% extends "djstripe/base.html" %}
{% load static djstripe_tags %}
{% block title %}Zana Edge Subscription{% endblock title %}
{% block content %}
<!-- Modal for server update -->
<div class="modal fade" id="in-progress">
<div class="modal-dialog">
<div class="modal-content">
* what it's like to not be technical in the industry
* what you do in tech that people forget is needed
* the most interesting thing you've worked on recently
* what your day-to-day is like
* must-have gifs for every techie
* horrible code from the past that shows I'm much better now
* the best music for hacking
* mistakes you've made that make you groan
* how you've made it at well-known companies
* self-care in the tech bubble