anie codeskol
anie codeskol

Reputation: 105

python3 manage.py runserver

Having issues running django site with python3 manage.py runserver command. I have installed django-bootstrap-ui package and added the right name to my INSTALLED_APPS but still get error below:

(django_env)my_machine@my_pc:~/srv_django/etransphere$ python3 manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f14d33458c8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'bootstrap_ui'

Running pip list and pip show django-bootstrap-ui both show that the package has been installed in my virtual environment

Upvotes: 3

Views: 10094

Answers (2)

Dcase Mhrz
Dcase Mhrz

Reputation: 1

This is due to the errors while installing your new app in settings.py and urls.py. I had the same error after editng those files to add a new app.

Solution: Check urls.py

urlpatterns = [
url(r'^admin/', admin.site.urls),
*#this may be the place where you entered the app url but created an syntax error.*

And Check settings.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

]

While you entered the app name in INSTALLED APPS list You might have Entered the wrong name

My cause of Error: I forgot to enter the comma after entering the app name

INSTALLED_APPS = [
'appName'  <<<<<<< 
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

]

Upvotes: 0

anie codeskol
anie codeskol

Reputation: 105

I figured out the problem with the msissing package when using Python3 was that I was running the installation of my packages using pip:

pip install django-bootstrap-ui

instead of pip3.

sudo -H pip3 install django-bootstrap-ui

While installing django I had used pip3 and as such the application starts off using the Python3 library and site-packages. Using pip to install any package will uncompress it files into the Python2 directory which is not being used by my django install (recall I used pip3 to install django). However, using pip3 compress the added packages into the Python3 directory which my django install uses thus can see the package. Error eliminated :D

Upvotes: 1

Related Questions