Can't import custom module(flask and Python)

I have created a virtualenv on Pythonanywhere and have installed my dependencies(brainyquote) but when ever I run my website I get an error and on checking the logs I get the following eror:

But when I check in my virtual env I get the following:

i am new to flask and pythonanywhere. So it would be of great help if anyone can help me. Good Day

Is your webapp configured to use the virtualenv that you have installed your dependencies into? (on the webapp page on PythonAnywhere there's a spot for you to set your virtualenv)

I have no clue about that. How do I go about that? My app runs perfectly on my local machine though.

Yes I have setup my virtual env on my web app.

Deploy is the name of my virtualenv


But the app still does not work. Any idea ?

Have you taken a look at your error logs?

Okay, so I found a way to handle the module error. Instead of setting up a virtualenv I decide to upload the files simply and install modules using bash console. I pip installed all the requirements. So in my app folder, I have only one file which has the code. I uploaded the file and everything went smooth but on opening my file I get the following error:

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. This is my code:

So I was checking at the logs of my app and i got the following error:

2017-11-20 11:33:41,786: Starting new HTTP connection (1): proxy.server 2017-11-20 11:33:41,797: [2017-11-20 11:33:41,794] ERROR in app: Exception on / [GET] 2017-11-20 11:33:41,797: Traceback (most recent call last): 2017-11-20 11:33:41,798: File "/usr/local/lib/python2.7/dist-packages/flask/", line 1988, in wsgi_app 2017-11-20 11:33:41,798: response = self.full_dispatch_request() 2017-11-20 11:33:41,798: File "/usr/local/lib/python2.7/dist-packages/flask/", line 1641, in full_dispatch_request 2017-11-20 11:33:41,798: rv = self.handle_user_exception(e) 2017-11-20 11:33:41,798: File "/usr/local/lib/python2.7/dist-packages/flask/", line 1544, in handle_user_exception 2017-11-20 11:33:41,799: reraise(exc_type, exc_value, tb) 2017-11-20 11:33:41,799: File "/usr/local/lib/python2.7/dist-packages/flask/", line 1639, in full_dispatch_request 2017-11-20 11:33:41,799: rv = self.dispatch_request() 2017-11-20 11:33:41,799: File "/usr/local/lib/python2.7/dist-packages/flask/", line 1625, in dispatch_request 2017-11-20 11:33:41,799: return self.view_functionsrule.endpoint 2017-11-20 11:33:41,800: File "/home/akulchhillar3007/mysite/", line 15, in hello_world 2017-11-20 11:33:41,800: tweet = str(z[0]) + " " + "#shnizrthebot" 2017-11-20 11:33:41,800: IndexError: list index out of range 2017-11-20 11:33:41,794: Exception on / [GET]#012Traceback (most recent call last):#012 File "/usr/local/lib/python2.7/dist-packages/flask/", line 1988, in wsgi_app#012 response = self.full_dispatch_request()#012 File "/usr/local/lib/python2.7/dist-packages/flask/", line 1641, in full_dispatch_request#012 rv = self.handle_user_exception(e)#012 File "/usr/local/lib/python2.7/dist-packages/flask/", line 1544, in handle_user_exception#012 reraise(exc_type, exc_value, tb)#012 File "/usr/local/lib/python2.7/dist-packages/flask/", line 1639, in full_dispatch_request#012 rv = self.dispatch_request()#012 File "/usr/local/lib/python2.7/dist-packages/flask/", line 1625, in dispatch_request#012 return self.view_functionsrule.endpoint#012 File "/home/akulchhillar3007/mysite/", line 15, in hello_world#012 tweet = str(z[0]) + " " + "#shnizrthebot"#012IndexError: list index out of range

I don't get it. When the app is run on my laptop there is no error of list index out of range. But here I get this error

So I changed the code a bit. But now when I try to reload my web from Pythonanywhere the website does not load it. What is the issue?

On checking the logs the following was the error:

Starting new HTTP connection (1): proxy.server

Perhaps take a look at the response body and see what it says? As a free user, you won't be able to access an external site that is not on the whitelist.