Added context-handling

legacy
Steve L. Nyemba 8 years ago
parent 8b7467219d
commit ddca8f7c09

@ -18,6 +18,7 @@ PORT = 8100 if 'port' not in PARAMS else int(PARAMS['port']) ;
path = PARAMS['path'] #os.environ['CONFIG']
f = open(path)
CONFIG = json.loads(f.read())
CONTEXT= ('/'+PARAMS['context']) if 'context' in PARAMS else ''
stripe_keys = {
'secret_key': CONFIG['stripe']['secret'].strip(),
'publishable_key': CONFIG['stripe']['pub'].strip()
@ -165,7 +166,7 @@ def get_plans(app_name) :
#
# @TODO: Mark the plans the current user is signed up for
#
return render_template('subscribe.html',uid=uid,app_name=app_name,plans=plans,apikey=apikey)
return render_template('subscribe.html',context=CONTEXT,uid=uid,app_name=app_name,plans=plans,apikey=apikey)
@app.route('/subscribe/<name>',methods=['DELETE'])
def cancel_subscribe(name) :
@ -199,7 +200,7 @@ def is_customer (app_name):
apikey = CONFIG['stripe']['pub'].strip()
amount = amount / 100
return render_template('bill.html',apikey=apikey,app_name=app_name.replace('-',' '),plans=plans,total_amount=amount)
return render_template('bill.html',context=CONTEXT,apikey=apikey,app_name=app_name.replace('-',' '),plans=plans,total_amount=amount)
if __name__ == '__main__' :
app.debug = True ;

@ -57,7 +57,7 @@
<tr>
<td style="width:50%">
<div align="left" class="default">
<img src="/static/img/logo-0.png" style="width:48px; margin:4px" class="left" style="margin:4px">
<img src="{{context}}/static/img/logo-0.png" style="width:48px; margin:4px" class="left" style="margin:4px">
<div style="padding:8px">The Phi Technology
<div class="small" style="text-transform:capitalize">{{ app_name }}</div>
</div>

@ -1,7 +1,7 @@
<meta charset="UTF-8">
<meta http-equiv="cache-control" content="no-cache">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1">
<link rel="shortcut icon" href="/static/img/logo-0.png">
<link rel="shortcut icon" href="{{context}}/static/img/logo-0.png">
<title style="text-transform: capitalize">{{app_name.replace('-',' ')}}</title>
<style>
body{
@ -66,7 +66,7 @@
<tr>
<td style="width:50%">
<div align="left" class="default">
<img src="/static/img/logo-0.png" style="width:48px; margin:4px" class="left" style="margin:4px">
<img src="{{context}}/static/img/logo-0.png" style="width:48px; margin:4px" class="left" style="margin:4px">
<div style="padding:8px">The Phi Technology
<div class="small" style="text-transform:capitalize">{{ app_name }}</div>
</div>
@ -107,7 +107,7 @@
</div>
<br>
<div>
<form action="/subscribe/{{app_name|safe}}" method="POST">
<form action="{{context}}/subscribe/{{app_name|safe}}" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="{{apikey|safe}}"

Loading…
Cancel
Save