Skip to content

Instantly share code, notes, and snippets.

@straxico
Created January 22, 2018 22:47
Show Gist options
  • Save straxico/eb2c1589cb10523f376dcacae6dc1806 to your computer and use it in GitHub Desktop.
Save straxico/eb2c1589cb10523f376dcacae6dc1806 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# Use Python 3
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
import telepot
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] ='postgres://gumexomocolokm:5cba02a060300da97568c0afbabdbec7c95da1d9099197414bf9df0af4d16064@ec2-54-243-253-24.compute-1.amazonaws.com:5432/dffcudadce0uo8'
db = SQLAlchemy(app)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
comment = db.Column(db.String(400))
def __init__(self, name, comment):
self.name = name
self.comment = comment
def __repr__(self):
return 'Name %r ' % self.name
#a=db.session.query(User).all()
#for i in range(len(a)):
# print(a[i].comment)
@app.route('/')
def hello():
return 'strix bot'
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
while 1:
time.sleep(10)
#db.session.query(User).all()
#peter = User.query.filter_by(username='peter').first()
#x=str(User.query.filter_by(name='59610351').first().comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment