Black Lives Matter. Please consider donating to Black Girls Code today.

Deploying Twitter Streaming APP

Hi fellows,

I’m trying to deploy a twitter live monitor on Heroku but I’m not finding references on how to do it.

I need to run two different files (streaming.py and app.py) and I have tried a lot of different approaches and also, articles or forum posts about the subject but I didn’t find anything so clear.

Anyone can help me giving me some reference or telling me what I need to do to it works?

I deployed the webapp, but it’s not collecting the tweets and updating the app:
https://bbb20-monitor.herokuapp.com/

I tried to set the streaming.py into Procfile but it still not working.

web: gunicorn app:server
worker: python streaming.py

-----> Discovering process types
Procfile declares types -> web, worker

What I’m doing wrong here, why it’s not working?

Link to the github repository with the code: https://github.com/kaburelabs/bbb-twitter-monitor

I would be veeeery grateful if someone can give me some direction to deploy this type of app

The error on Heroku log:

2020-03-22T01:07:14.872429+00:00 heroku[router]: at=info method=POST path="/_dash-update-component" host=bbb20-monitor.herokuapp.com request_id=ef8713d3-fb3f-4750-8e13-86a098ab7ded fwd="189.79.112.79" dyno=web.1 connect=1ms service=3ms status=500 bytes=470 protocol=https
2020-03-22T01:07:14.868335+00:00 app[web.1]: Exception on /_dash-update-component [POST]
2020-03-22T01:07:14.868344+00:00 app[web.1]: Traceback (most recent call last):
2020-03-22T01:07:14.868345+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/sql.py", line 1586, in execute
2020-03-22T01:07:14.868345+00:00 app[web.1]:     cur.execute(*args, **kwargs)
2020-03-22T01:07:14.868346+00:00 app[web.1]: sqlite3.OperationalError: no such table: tweet
2020-03-22T01:07:14.868347+00:00 app[web.1]: 
2020-03-22T01:07:14.868347+00:00 app[web.1]: The above exception was the direct cause of the following exception:
2020-03-22T01:07:14.868348+00:00 app[web.1]: 
2020-03-22T01:07:14.868348+00:00 app[web.1]: Traceback (most recent call last):
2020-03-22T01:07:14.868352+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
2020-03-22T01:07:14.868352+00:00 app[web.1]:     response = self.full_dispatch_request()
2020-03-22T01:07:14.868352+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
2020-03-22T01:07:14.868353+00:00 app[web.1]:     rv = self.handle_user_exception(e)
2020-03-22T01:07:14.868353+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
2020-03-22T01:07:14.868354+00:00 app[web.1]:     reraise(exc_type, exc_value, tb)
2020-03-22T01:07:14.868354+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
2020-03-22T01:07:14.868354+00:00 app[web.1]:     raise value
2020-03-22T01:07:14.868355+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
2020-03-22T01:07:14.868355+00:00 app[web.1]:     rv = self.dispatch_request()
2020-03-22T01:07:14.868356+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
2020-03-22T01:07:14.868356+00:00 app[web.1]:     return self.view_functions[rule.endpoint](**req.view_args)
2020-03-22T01:07:14.868357+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py", line 1461, in dispatch
2020-03-22T01:07:14.868357+00:00 app[web.1]:     response.set_data(self.callback_map[output]["callback"](*args))
2020-03-22T01:07:14.868357+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py", line 1341, in add_context
2020-03-22T01:07:14.868358+00:00 app[web.1]:     output_value = func(*args, **kwargs)  # %% callback invoked %%
2020-03-22T01:07:14.868358+00:00 app[web.1]:   File "/app/app.py", line 409, in _update_div1
2020-03-22T01:07:14.868358+00:00 app[web.1]:     df = pd.read_sql_query("SELECT * from tweet", con)
2020-03-22T01:07:14.868359+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/sql.py", line 332, in read_sql_query
2020-03-22T01:07:14.868359+00:00 app[web.1]:     chunksize=chunksize,
2020-03-22T01:07:14.868360+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/sql.py", line 1633, in read_query
2020-03-22T01:07:14.868360+00:00 app[web.1]:     cursor = self.execute(*args)
2020-03-22T01:07:14.868361+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/sql.py", line 1598, in execute
2020-03-22T01:07:14.868361+00:00 app[web.1]:     raise ex from exc
2020-03-22T01:07:14.868361+00:00 app[web.1]: pandas.io.sql.DatabaseError: Execution failed on sql 'SELECT * from tweet': no such table: tweet
2020-03-22T01:07:14.869652+00:00 app[web.1]: 10.16.155.42 - - [22/Mar/2020:01:07:14 +0000] "POST /_dash-update-component HTTP/1.1" 500 290 "https://bbb20-monitor.herokuapp.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"