minor bug fixes

legacy
Steve Nyemba 3 years ago
parent 9438144772
commit 255e9ede59

@ -15,7 +15,7 @@ from flask_session import Session
from flask_cors import CORS from flask_cors import CORS
from flask_pymongo import PyMongo from flask_pymongo import PyMongo
from flask_mongo_sessions import MongoDBSessionInterface from flask_mongo_sessions import MongoDBSessionInterface
import transport
import stripe import stripe
import json import json
# from StringIO import StringIO # from StringIO import StringIO
@ -53,18 +53,21 @@ app = Flask(__name__)
CORS(app) CORS(app)
SYS_STORE = CONFIG['store'] SYS_STORE = CONFIG['store']
LOGGER = transport.factory.instance(**SYS_STORE['logger'])
# @app.route("/donate") # @app.route("/donate")
# def _donate() : # def _donate() :
# amount = float(request.args['amount']) if 'amount' in request.args else 5.0 # amount = float(request.args['amount']) if 'amount' in request.args else 5.0
# args = {'amount':amount,'context':CONTEXT} # args = {'amount':amount,'context':CONTEXT}
# return render_template('donate.html',**args) # return render_template('donate.html',**args)
def get_id(id):
return CONFIG['default']['id'] if not id else id
@app.route("/") @app.route("/")
def index(): def index():
if 'default' in CONFIG: if 'default' in CONFIG:
id = CONFIG['default']['id'] id = CONFIG['default']['id']
return get_plans_ui(id) return get_plans_ui(id)
headers = {"content-type":"application/json"} headers = {"content-type":"application/json"}
mystore = store.factory.instance(name='music') mystore = store.factory.instance(name='music')
products = mystore.get.products() products = mystore.get.products()
@ -234,6 +237,7 @@ def get_plans_ui(id):
This function loads the form for signup and information about the various plans for a given product. This function loads the form for signup and information about the various plans for a given product.
:id name of the products :id name of the products
""" """
id = get_id(id) #-- will return default if need be
mystore = store.factory.instance(name=id) mystore = store.factory.instance(name=id)
# #
# sort plans by # sort plans by
@ -243,7 +247,6 @@ def get_plans_ui(id):
args = {"product":id,"label":label,"description":description,"context":CONTEXT,"plans":mystore.get.plans(),"now":datetime.now().year} args = {"product":id,"label":label,"description":description,"context":CONTEXT,"plans":mystore.get.plans(),"now":datetime.now().year}
args['product'] = mystore.product args['product'] = mystore.product
args['theme'] = 'theme-clouds' args['theme'] = 'theme-clouds'
# print (mystore.product.keys())
session['cloud-view'] = CONFIG['cloud-view'].replace(':id',id) session['cloud-view'] = CONFIG['cloud-view'].replace(':id',id)
session['product'] = mystore.product session['product'] = mystore.product
return render_template('plans.html',**args) return render_template('plans.html',**args)
@ -382,6 +385,7 @@ def init(product):
user = mystore.user user = mystore.user
user.init (uid) user.init (uid)
# prrint (user.plan.info())
if not user.plan.info() : if not user.plan.info() :
mystore.plan.subscribe(email = user.info()['email']) mystore.plan.subscribe(email = user.info()['email'])
@ -449,16 +453,16 @@ def features(product):
if __name__ == '__main__' : if __name__ == '__main__' :
# #
# setup mongodb session management (not sure why) # setup mongodb session management (not sure why)
app.config['SESSION_TYPE'] = 'mongodb' #app.config['SESSION_TYPE'] = 'mongodb'
app.config['MONGO_URI'] = 'mongodb://localhost:27017' #app.config['MONGO_URI'] = 'mongodb://localhost:27017'
app.config['SESSION_MONGODB_DB'] = 'sessions' #app.config['SESSION_MONGODB_DB'] = CONFIG['store']['logger']['db']
app.config['SESSION_MONGODB_COLLECT'] = 'store' #app.config['SESSION_MONGODB_COLLECT'] = 'session'
mongo = PyMongo(app) #mongo = PyMongo(app)
app.session_interface = MongoDBSessionInterface(app,mongo.db, 'store') #app.session_interface = MongoDBSessionInterface(app,mongo.db, 'store')
app.debug = True ; app.debug = True ;
app.secret_key = '360-8y-[0v@t10n]+kr81v17y' app.secret_key = '360-8y-[0v@t10n]+kr81v17y'
app.config['MAX_CONTENT_LENGTH'] = 1600 * 1024 * 1024 app.config['MAX_CONTENT_LENGTH'] = 1600 * 1024 * 1024
Session(app) #Session(app)
app.run(port=PORT,threaded=True,host='0.0.0.0') app.run(port=PORT,threaded=True,host='0.0.0.0')
# app.run() #'0.0.0.0',PORT,True,threaded=True) # app.run() #'0.0.0.0',PORT,True,threaded=True)

@ -364,7 +364,7 @@ $(document).ready(function(){
<div align="center"> <div align="center">
all rights reserved &copy; {{ now }}, The Phi Technologys all rights reserved &copy; {{ now }}, The Phi Technologys
</div> </div>
<div align="center"> <div align="center" class="active" onclick="jx.modal.show({url:'{{context}}/terms'})">
Privacy & Terms Privacy & Terms
</div> </div>

@ -0,0 +1,22 @@
<meta charset="UTF-8">
<!--
(c) 2018 - The Phi Technology LLC
steve@the-phi.comf.ff/'fum 9 mmmmp m87 b
-->
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1">
<link href="{{ context }}/static/css/default.css" rel="stylesheet" type="text/css">
<link href="{{ context }}/static/css/fa/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<div style="height:100%;">
{% include 'header.html' %}
<p><div class="caption">Terms of Use</div></p>
<p class="border-round text">
The Phi Technology offers a wide range of services and products that are intended to be used to empower end-users.
As such we reserve the rights to cancel/disable/ban any user from using any of our products if we deem they are misusing anyone of our products.
</p>
</div>

@ -8,3 +8,4 @@ flask-mongo-sessions
flask-pymongo flask-pymongo
flask-session flask-session
git+https://dev.the-phi.com/git/steve/data-transport.git git+https://dev.the-phi.com/git/steve/data-transport.git
stripe==2.48.0
Loading…
Cancel
Save