How do I run my Flask app remotely using MongoHQ and Heroku (Python) -


i have script written in python lets me consume tweets terminal locally hosted mongodb database. improve uptime, host script remotely on heroku , shoot consumed tweets database hosted mongohq. without using django, use flask framework deploy app heroku (described here: https://devcenter.heroku.com/articles/python).

when run simple "hello world" app using setup, fine. however, when try run tweet consuming app, crashes. how can change app work flask/heroku/mongohq setup? source code is:

import json import pymongo import tweepy  consumer_key = "" consumer_secret = "" access_key = "" access_secret = ""  auth = tweepy.oauthhandler(consumer_key, consumer_secret) auth.set_access_token(access_key, access_secret) api = tweepy.api(auth)   class customstreamlistener(tweepy.streamlistener):     def __init__(self, api):         self.api = api         super(tweepy.streamlistener, self).__init__()          self.db = pymongo.mongoclient().test      def on_data(self, tweet):         self.db.tweets.insert(json.loads(tweet))      def on_error(self, status_code):         return true # don't kill stream      def on_timeout(self):         return true # don't kill stream   sapi = tweepy.streaming.stream(auth, customstreamlistener(api)) sapi.filter(track=['rooney']) 

i new programming imagine solution problem might quite straight forward. however, stuck , use progress.

it's hard debug without more information, first guess don't have dependancies installed.

heroku gives clean python environment. however, need special libraries tweepy don't installed default. thus, have let heroku know install these.

you'll need use pip , requirements.txt document lists out libraries trying use version numbers.

https://devcenter.heroku.com/articles/python-pip


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -