Macitosh:project user$ python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 26 2016, 12:10:39)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.10.5
>>>
But when I try to run the version check using a different command I get the below error, and the same error while subsequently starting the server
Parths-Macitosh:project parth$ python -m django --version
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Library/Python/2.7/site-packages/django/__main__.py", line 9, in <module>
management.execute_from_command_line()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/Library/Python/2.7/site-packages/django/__init__.py", line 22, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/Library/Python/2.7/site-packages/django/utils/log.py", line 69, in configure_logging
logging_config_func = import_string(logging_config)
File "/Library/Python/2.7/site-packages/django/utils/module_loading.py", line 27, in import_string
six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
File "/Library/Python/2.7/site-packages/django/utils/module_loading.py", line 23, in import_string
return getattr(module, class_name)
ImportError: Module "logging.config" does not define a "dictConfig" attribute/class
Any thoughts?
Thanks,
PS
Hi,
the --version option of the "python" command shows you the version of Python, not of Django. The -m option doesn't merely import the module you specify, it imports it and executes it, and Django isn't designed to do this. So the way to check its version the one you showed first. If you want to run it with a one-liner, it's this:
python -c 'import django; print(django.get_version())'
Antonis Christofides http://djangodeployment.com
--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ff5c496c-7be7-4ca7-a5b4-88b2744ee3c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.