I may be speaking a bit out of my depth here, but I wonder if it's maybe because you haven't created __init__.py files in the directories? I believe Django (well, Python), requires an empty __init__.py file in directories when loading them as modules:
-- https://docs.python.org/3/tutorial/modules.html#packages
If it's not that, then I have no idea!
Nate
On Wednesday, April 5, 2017 at 11:28:23 AM UTC-5, jjander...@gmail.com wrote:
On Wednesday, April 5, 2017 at 11:28:23 AM UTC-5, jjander...@gmail.com wrote:
Hi,
I'm setting up a Django app using Django 1.10.3 and python 3.5.2. When I run the following command in my 3.5.2 virtual environment:
python manage.py runserver
prior to entering the app in INSTALLED_APPS in settings.py, my webpage comes up fine.
When I add the following line to INSTALLED_APPS:
'util.siggy.apps.SiggyConfig',
I get the following error message:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f47313e7620>
Traceback (most recent call last):
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ In my project directory, I have a path .../project_dir/util/siggy/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ django/core/management/ commands/runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/jja/testenv3.5/lib/python3.5/site-packages/ django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'util.siggy'apps.py that has the class SiggyConfig defined in it.
It looks to me that python is not finding my util/siggy directory, but I'm not sure why. I included a print statement
in manage.py and it prinsts out the sys.path as:
['/home/jja/prog/dev/newSiggy',
'/home/jja/testenv3.5/lib/python3.5/site-packages/ django_classy_tags-0.8.0-py3. 5.egg',
'/home/jja/testenv3.5/lib',
'/usr/lib/python35.zip',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/home/jja/testenv3.5/lib/python3.5/site-packages']
where /home/jja/prog/dev/newSiggy is the path to my Django project root.
The full path to my app is /home/jja/prog/dev/newSiggy/util/siggy/apps.py.
It is a mystery to my why python cannot find 'util.siggy'.
I've looked on the web and have not found a case that seems to match mine (some are close). I have tried changing a few
path related settings, but so far, no success.
Any suggestions on what to try next?
Jim A.
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/cd7eca9e-7ea2-4bcd-8c05-97bedc26cd6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment