Forums

No module named bootstrap3

I installed the following in my virtualenv:

$ pip install django-bootstrap3
 Collecting django-bootstrap3
  Downloading django-bootstrap3-9.1.0.tar.gz
Building wheels for collected packages: django-bootstrap3
  Running setup.py bdist_wheel for django-bootstrap3 ... done
  Stored in directory: /home/matrim/.cache/pip/wheels/72/e0/e8/4cb3d765c70ddf660249ac8136b57ec5da9ba9ecc5290d70c4
Successfully built django-bootstrap3
Installing collected packages: django-bootstrap3
Successfully installed django-bootstrap3-9.1.0

Then I added bootstrap3 in settings.py

INSTALLED_APPS = [ 
    'user.apps.UserConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'bootstrap3',
]

When I go to run a webpage, I get in the error log

2018-02-04 17:32:28,083: Error running WSGI application
2018-02-04 17:32:28,084: ImportError: No module named 'bootstrap3'
2018-02-04 17:32:28,084:   File "/var/www/matrim_pythonanywhere_com_wsgi.py", line 25, in <module>

This runs OK

python -i /var/www/matrim_pythonanywhere_com_wsgi.py
>>> import matrimsite.settings

This runs OK too

$ python -i /var/www/matrim_pythonanywhere_com_wsgi.py
>>> import bootstrap3

THis gives me

>>> print (bootstrap3)
<module 'bootstrap3' from '/home/matrim/.virtualenvs/django110/lib/python3.5/site-packages/bootstrap3/__init__.py'>

I had the same problem when I installed crispy_forms too.

Seems like it is happening with any new package I install. What step am I missing?

Your webapp config needs to be setup to use your virtualenv- you can do so on PythonAnywhere under the web tab.

I added path to my virtual environment under the web tab (virtualenv section). I was missing this. It is OK now. Thank you for pointing this out.

same :'(

Have you installed all of the packages you need into the virtualenv you're using? The quickest way to do that is to use the "Start a Bash console in this virtualenv" link on the "Web" page, and then use the pip command to install them. Once you've done that, reload the website's code using the green button on the "Web" page.

I was having the same issue it seems the solution is using "django-bootstrap3" versus just "bootstrap3"