Forums

Import Module not working

Hi,

I am trying to import the pyrebase module to my flask app. I have created, activated, and connected a virtual environment with my web app already. I have pip3 installed pyrebase on that virtualenv.

In addition, going through the debugging ImportError page, I was able to successfully run my wgsi file with no errors. I tried importing pyrebase in the python console that it opened up, and even that was successful.

This is the command I ran in my virtualenv on the bash console: python3 -i /var/www/nikashkhanna_pythonanywhere_com_wsgi.py

My issue is when I run the app with the "run" button on the web app.

The console below the file says that it is unable to find the pyrebase module and I am confused as to why this is happening. I have setup my web app to use the virtualenv that I created (using the mkvirtualenv command that was recommended). This leads me to believe that my issue is with linking my virtualenv to my web app.

Please let me know if anyone can help me with this issue. Thanks in advance.

The run button does not automatically know which virtualenv you want to run your code in. See http://help.pythonanywhere.com/pages/SaveAndRunPythonVersion/