django/djangopeople

hasattr() : attribute must be string. (Django | python3.5 | apache2 | mod_wsgi)

kishorvb opened this issue · 1 comments

Hi,

I am unable to bring up a Django project. I have ported my code from python2.7 to python 3.5.2. I am using mod_wsgi for python3. When I try to run I get the below error.
Added error log of apache2. I am running it on local host.
I dont know where exactly the issue lies. I am new to Django . any help would be appreciated.

Thank you.

smartdna <class 'smartdna.models.PostmortemImage'>
[Thu Jul 23 21:21:12.815166 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] mod_wsgi (pid=13459): Target WSGI script '/home/kishor/ENVS/linksmart_full/smartDNA/smartdna.py' cannot be loaded as Python module.
[Thu Jul 23 21:21:12.820450 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] mod_wsgi (pid=13459): Exception occurred processing WSGI script '/home/kishor/ENVS/linksmart_full/smartDNA/smartdna.py'.
[Thu Jul 23 21:21:12.821026 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] Traceback (most recent call last):
[Thu Jul 23 21:21:12.821206 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/linksmart_full/smartDNA/smartdna.py", line 18, in
[Thu Jul 23 21:21:12.821248 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] application = get_wsgi_application()
[Thu Jul 23 21:21:12.821294 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Jul 23 21:21:12.821331 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] django.setup(set_prefix=False)
[Thu Jul 23 21:21:12.821376 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/init.py", line 27, in setup
[Thu Jul 23 21:21:12.821414 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] apps.populate(settings.INSTALLED_APPS)
[Thu Jul 23 21:21:12.821478 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/apps/registry.py", line 116, in populate
[Thu Jul 23 21:21:12.821524 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] app_config.ready()
[Thu Jul 23 21:21:12.821568 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/apps.py", line 23, in ready
[Thu Jul 23 21:21:12.821605 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] self.module.autodiscover()
[Thu Jul 23 21:21:12.821652 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/init.py", line 26, in autodiscover
[Thu Jul 23 21:21:12.821690 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] autodiscover_modules('admin', register_to=site)
[Thu Jul 23 21:21:12.821734 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
[Thu Jul 23 21:21:12.821772 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] import_module('%s.%s' % (app_config.name, module_to_search))
[Thu Jul 23 21:21:12.821816 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
[Thu Jul 23 21:21:12.821852 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] return _bootstrap._gcd_import(name[level:], package, level)
[Thu Jul 23 21:21:12.821896 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "", line 986, in _gcd_import
[Thu Jul 23 21:21:12.821943 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "", line 969, in _find_and_load
[Thu Jul 23 21:21:12.821989 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "", line 958, in _find_and_load_unlocked
[Thu Jul 23 21:21:12.822035 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "", line 673, in _load_unlocked
[Thu Jul 23 21:21:12.822092 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "", line 665, in exec_module
[Thu Jul 23 21:21:12.822138 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "", line 222, in _call_with_frames_removed
[Thu Jul 23 21:21:12.822185 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/linksmart_full/smartDNA/smartdna/admin.py", line 495, in
[Thu Jul 23 21:21:12.822222 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] admin.site.register(PostmortemImage, PostmortemImageAdmin)
[Thu Jul 23 21:21:12.822265 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/sites.py", line 110, in register
[Thu Jul 23 21:21:12.822303 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] system_check_errors.extend(admin_obj.check())
[Thu Jul 23 21:21:12.822346 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/options.py", line 117, in check
[Thu Jul 23 21:21:12.822383 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] return self.checks_class().check(self, **kwargs)
[Thu Jul 23 21:21:12.822443 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/checks.py", line 519, in check
[Thu Jul 23 21:21:12.822489 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] errors.extend(self._check_list_display(admin_obj))
[Thu Jul 23 21:21:12.822533 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/checks.py", line 595, in _check_list_display
[Thu Jul 23 21:21:12.822570 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] for index, item in enumerate(obj.list_display)
[Thu Jul 23 21:21:12.822614 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/checks.py", line 595, in
[Thu Jul 23 21:21:12.822652 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] for index, item in enumerate(obj.list_display)
[Thu Jul 23 21:21:12.822695 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] File "/home/kishor/ENVS/myenv/lib/python3.5/site-packages/django/contrib/admin/checks.py", line 601, in _check_list_display_item
[Thu Jul 23 21:21:12.822733 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] elif hasattr(obj, item):
[Thu Jul 23 21:21:12.822792 2020] [wsgi:error] [pid 13459:tid 140302506690304] [remote 127.0.0.1:19137] TypeError: hasattr(): attribute name must be string

This is the issue tracker for the people.djangoproject.com website. Please see TicketClosingReasons/UseSupportChannels for ways to get help with Django usage.