Django is not working

53 views
Skip to first unread message

Tom Gertin

unread,
Aug 22, 2019, 5:45:00 PM8/22/19
to Django users
Hello, I have successfully install Django 1.11.22. However, I believe something is wrong because I cannot get the command that lists its version to work, in addition the manage.py help command also produces the same error. Here is the error.

$ pip install Django==1.11.22
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting Django==1.11.22
Requirement already satisfied: pytz in /home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages (from Django==1.11.22) (2019.1)
Installing collected packages: Django
  Found existing installation: Django 1.11.21
    Uninstalling Django-1.11.21:
      Successfully uninstalled Django-1.11.21
Successfully installed Django-1.11.22
WARNING: You are using pip version 19.1.1, however version 19.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ python -m django --version
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages/django/__main__.py", line 9, in <module>
    management.execute_from_command_line()
  File "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/config.py", line 120, in create
    mod = import_module(mod_path)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named contrib

Help would be appreciated. Also, what is odd is that if I enter the python console, I can import django and print out the version.

Thanks,

Tom

Gerardo Palazuelos Guerrero

unread,
Aug 22, 2019, 6:09:42 PM8/22/19
to django...@googlegroups.com
hi Tom,
Not sure what exactly configuration you have, but text you sent says you have python 2.7 and somehow a virtual environment (venv) is mentioned in the stacktrace.
I don't use python 2.7, so my following suggestions considers a recent version.

May i suggest you to check djangogirls for proper installation.
Also:

good luck.
--
Gerardo Palazuelos Guerrero



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/471a2ef7-8032-420f-8fd2-027f005d1d55%40googlegroups.com.

Akash Sinha

unread,
Aug 23, 2019, 12:05:57 AM8/23/19
to django...@googlegroups.com
You are using python 2.7 with Django , I will suggest you should use python 3.6 or above.


--

Mike Dewhirst

unread,
Aug 23, 2019, 12:40:16 AM8/23/19
to Django users
Looking at the error below, I would recommend the following:

1. Upgrade pip

2. pip uninstall django

3. Reinstall the previous working version of Django and prove it is working

4. Restart the machine

5. Re-install Django 1.11.22

The traceback says it cannot find the contrib module which possibly means the upgrade to 1.11.22 didn't complete correctly the first time.

Good luck

Mike
Reply all
Reply to author
Forward
0 new messages