Re: Why does django throw TypeError when sending requests through Apache WSGI?
Hi, I think this is not related with apache It seems like class object property is called as a method somehow. Unfortunately the error does not reveal the property name. Regards, Sencer HAMARAT On Wed, Dec 8, 2021 at 4:59 PM Kyle Paterson wrote: > Started a new project after not using Django for roughly two years, works > fine when running as a development server but throws TypeError: > SimpleLazyObject class: property object not callable. > > From apache error log: > [Wed Dec 08 10:11:53.023239 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] Traceback (most recent call > last): > [Wed Dec 08 10:11:53.023283 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] File > "/home/kyle/active-travel/traveldata/traveldata/wsgi.py", line 14, in > > [Wed Dec 08 10:11:53.023327 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] from django.core.wsgi > import get_wsgi_application > [Wed Dec 08 10:11:53.023351 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] File > "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/__init__.py", > line 1, in > [Wed Dec 08 10:11:53.023371 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] from django.utils.version > import get_version > [Wed Dec 08 10:11:53.023377 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] File > "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/version.py", > line 7, in > [Wed Dec 08 10:11:53.023430 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] from > django.utils.regex_helper import _lazy_re_compile > [Wed Dec 08 10:11:53.023435 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] File > "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/regex_helper.py", > line 10, in > [Wed Dec 08 10:11:53.023524 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] from > django.utils.functional import SimpleLazyObject > [Wed Dec 08 10:11:53.023529 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] File > "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/functional.py", > line 364, in > [Wed Dec 08 10:11:53.023578 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] class > SimpleLazyObject(LazyObject): > [Wed Dec 08 10:11:53.023611 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] TypeError: Error when calling > the metaclass bases > [Wed Dec 08 10:11:53.023613 2021] [wsgi:error] [pid 10704:tid > 140343150348032] [remote 127.0.0.1:44946] 'property' object is not > callable > > Apache site config file: > > # The ServerName directive sets the request scheme, hostname and > port that > # the server uses to identify itself. This is used when creating > # redirection URLs. In the context of virtual hosts, the ServerName > # specifies what hostname must appear in the request's Host: > header to > # match this virtual host. For the default virtual host (this > file) this > # value is not decisive as it is used as a last resort host > regardless. > # However, you must set it for any further virtual host explicitly. > #ServerName www.example.com > > ServerAdmin webmaster@localhost > > Alias /static /home/kyle/active-travel/traveldata/static > > Require all granted > > > > > Require all granted > > > > WSGIScriptAlias / > /home/kyle/active-travel/traveldata/traveldata/wsgi.py > process-group=traveldata > WSGIDaemonProcess traveldata > python-home=/home/kyle/active-travel/venv > python-path=/home/kyle/active-travel/traveldata/traveldata > WSGIProcessGroup traveldata > > # Available loglevels: trace8, ..., trace1, debug, info, notice, > warn, > # error, crit, alert, emerg. > # It is also possible to configure the loglevel for particular > # modules, e.g. > #LogLevel info ssl:warn > LogLevel info > > ErrorLog ${APACHE_LOG_DIR}/error.log > CustomLog ${APACHE_LOG_DIR}/access.log combined > > # For most configuration files from conf-available/, which are > # enabled or disabled at a global level, it is possible to > # include a line for only one particular virtual host. For example > the > # following line enables the CGI configuration for this host only > # after it has been globally disabled with "a2disconf". > #Include conf-available/serve-cgi-bin.conf > > > Django project wsgi.py: > import os, sys > sys.path.append('home/kyle/active-travel/venv/lib/python3.8/site-packages' > ) > from django.core.wsg
Re: Why does django throw TypeError when sending requests through Apache WSGI?
with your settings usage, are you defining a property in settings and trying to use it anywhere? furthermore, are you using settings via from traveldata.traveldata import settings (example) or via from django.conf import settings The latter is the recommended means because settings are lazy loaded. On Wednesday, December 8, 2021 at 10:07:11 AM UTC-5 sencer...@gmail.com wrote: > Hi, > > I think this is not related with apache > > It seems like class object property is called as a method somehow. > Unfortunately the error does not reveal the property name. > > Regards, > Sencer HAMARAT > > > > On Wed, Dec 8, 2021 at 4:59 PM Kyle Paterson wrote: > >> Started a new project after not using Django for roughly two years, works >> fine when running as a development server but throws TypeError: >> SimpleLazyObject class: property object not callable. >> >> From apache error log: >> [Wed Dec 08 10:11:53.023239 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] Traceback (most recent call >> last): >> [Wed Dec 08 10:11:53.023283 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] File >> "/home/kyle/active-travel/traveldata/traveldata/wsgi.py", line 14, in >> >> [Wed Dec 08 10:11:53.023327 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] from django.core.wsgi >> import get_wsgi_application >> [Wed Dec 08 10:11:53.023351 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] File >> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/__init__.py", >> >> line 1, in >> [Wed Dec 08 10:11:53.023371 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] from django.utils.version >> import get_version >> [Wed Dec 08 10:11:53.023377 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] File >> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/version.py", >> >> line 7, in >> [Wed Dec 08 10:11:53.023430 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] from >> django.utils.regex_helper import _lazy_re_compile >> [Wed Dec 08 10:11:53.023435 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] File >> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/regex_helper.py", >> >> line 10, in >> [Wed Dec 08 10:11:53.023524 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] from >> django.utils.functional import SimpleLazyObject >> [Wed Dec 08 10:11:53.023529 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] File >> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/functional.py", >> >> line 364, in >> [Wed Dec 08 10:11:53.023578 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] class >> SimpleLazyObject(LazyObject): >> [Wed Dec 08 10:11:53.023611 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] TypeError: Error when calling >> the metaclass bases >> [Wed Dec 08 10:11:53.023613 2021] [wsgi:error] [pid 10704:tid >> 140343150348032] [remote 127.0.0.1:44946] 'property' object is not >> callable >> >> Apache site config file: >> >> # The ServerName directive sets the request scheme, hostname and >> port that >> # the server uses to identify itself. This is used when creating >> # redirection URLs. In the context of virtual hosts, the >> ServerName >> # specifies what hostname must appear in the request's Host: >> header to >> # match this virtual host. For the default virtual host (this >> file) this >> # value is not decisive as it is used as a last resort host >> regardless. >> # However, you must set it for any further virtual host >> explicitly. >> #ServerName www.example.com >> >> ServerAdmin webmaster@localhost >> >> Alias /static /home/kyle/active-travel/traveldata/static >> >> Require all granted >> >> >> >> >> Require all granted >> >> >> >> WSGIScriptAlias / >> /home/kyle/active-travel/traveldata/traveldata/wsgi.py >> process-group=traveldata >> WSGIDaemonProcess traveldata >> python-home=/home/kyle/active-travel/venv >> python-path=/home/kyle/active-travel/traveldata/traveldata >> WSGIProcessGroup traveldata >> >> # Available loglevels: trace8, ..., trace1, debug, info, notice, >> warn, >> # error, crit, alert, emerg. >> # It is also possible to configure the loglevel for particular >> # modules, e.g. >> #LogLevel info ssl:warn >> LogLevel info >> >> ErrorLog ${APACHE_LOG_DIR}/error.log >> CustomLog ${APACHE_LOG_DIR}/access.log c
Re: Why does django throw TypeError when sending requests through Apache WSGI?
I am not using either of those, I think. The only place I explicitly load settings is in wsgi.py, with the line: os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘travel data.settings' On Thu, 9 Dec 2021 at 12:52, Jason wrote: > > with your settings usage, are you defining a property in settings and > trying to use it anywhere? > > furthermore, are you using settings via > > from traveldata.traveldata import settings (example) > > or via > > from django.conf import settings > > The latter is the recommended means because settings are lazy loaded. > On Wednesday, December 8, 2021 at 10:07:11 AM UTC-5 sencer...@gmail.com > wrote: > >> Hi, >> >> I think this is not related with apache >> >> It seems like class object property is called as a method somehow. >> Unfortunately the error does not reveal the property name. >> >> Regards, >> Sencer HAMARAT >> >> >> >> On Wed, Dec 8, 2021 at 4:59 PM Kyle Paterson >> wrote: >> >>> Started a new project after not using Django for roughly two years, >>> works fine when running as a development server but throws TypeError: >>> SimpleLazyObject class: property object not callable. >>> >>> From apache error log: >>> [Wed Dec 08 10:11:53.023239 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] Traceback (most recent call >>> last): >>> [Wed Dec 08 10:11:53.023283 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] File >>> "/home/kyle/active-travel/traveldata/traveldata/wsgi.py", line 14, in >>> >>> [Wed Dec 08 10:11:53.023327 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] from django.core.wsgi >>> import get_wsgi_application >>> [Wed Dec 08 10:11:53.023351 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] File >>> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/__init__.py", >>> line 1, in >>> [Wed Dec 08 10:11:53.023371 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] from django.utils.version >>> import get_version >>> [Wed Dec 08 10:11:53.023377 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] File >>> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/version.py", >>> line 7, in >>> [Wed Dec 08 10:11:53.023430 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] from >>> django.utils.regex_helper import _lazy_re_compile >>> [Wed Dec 08 10:11:53.023435 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] File >>> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/regex_helper.py", >>> line 10, in >>> [Wed Dec 08 10:11:53.023524 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] from >>> django.utils.functional import SimpleLazyObject >>> [Wed Dec 08 10:11:53.023529 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] File >>> "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/functional.py", >>> line 364, in >>> [Wed Dec 08 10:11:53.023578 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] class >>> SimpleLazyObject(LazyObject): >>> [Wed Dec 08 10:11:53.023611 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] TypeError: Error when calling >>> the metaclass bases >>> [Wed Dec 08 10:11:53.023613 2021] [wsgi:error] [pid 10704:tid >>> 140343150348032] [remote 127.0.0.1:44946] 'property' object is not >>> callable >>> >>> Apache site config file: >>> >>> # The ServerName directive sets the request scheme, hostname and >>> port that >>> # the server uses to identify itself. This is used when creating >>> # redirection URLs. In the context of virtual hosts, the >>> ServerName >>> # specifies what hostname must appear in the request's Host: >>> header to >>> # match this virtual host. For the default virtual host (this >>> file) this >>> # value is not decisive as it is used as a last resort host >>> regardless. >>> # However, you must set it for any further virtual host >>> explicitly. >>> #ServerName www.example.com >>> >>> ServerAdmin webmaster@localhost >>> >>> Alias /static /home/kyle/active-travel/traveldata/static >>> >>> Require all granted >>> >>> >>> >>> >>> Require all granted >>> >>> >>> >>> WSGIScriptAlias / >>> /home/kyle/active-travel/traveldata/traveldata/wsgi.py >>> process-group=traveldata >>> WSGIDaemonProcess traveldata >>> python-home=/home/kyle/active-travel/venv >>> python-path=/home/kyle/active-travel/traveldata/traveldata >>> WSGIProcessGroup traveldata >>> >>> # Available loglevels: trace8, ..., trace1, debug, info, notice, >>> warn, >>> # error, cr
Re: Why does django throw TypeError when sending requests through Apache WSGI?
Used libapache2-mod-wsgi-py3 instead of python 2 version On Wednesday, 15 December 2021 at 10:03:27 UTC Kyle Paterson wrote: > I am not using either of those, I think. The only place I explicitly load > settings is in wsgi.py, with the line: > os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘travel data.settings' > > On Thu, 9 Dec 2021 at 12:52, Jason wrote: > >> >> with your settings usage, are you defining a property in settings and >> trying to use it anywhere? >> >> furthermore, are you using settings via >> >> from traveldata.traveldata import settings (example) >> >> or via >> >> from django.conf import settings >> >> The latter is the recommended means because settings are lazy loaded. >> On Wednesday, December 8, 2021 at 10:07:11 AM UTC-5 sencer...@gmail.com >> wrote: >> >>> Hi, >>> >>> I think this is not related with apache >>> >>> It seems like class object property is called as a method somehow. >>> Unfortunately the error does not reveal the property name. >>> >>> Regards, >>> Sencer HAMARAT >>> >>> >>> >>> On Wed, Dec 8, 2021 at 4:59 PM Kyle Paterson >>> wrote: >>> Started a new project after not using Django for roughly two years, works fine when running as a development server but throws TypeError: SimpleLazyObject class: property object not callable. From apache error log: [Wed Dec 08 10:11:53.023239 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] Traceback (most recent call last): [Wed Dec 08 10:11:53.023283 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] File "/home/kyle/active-travel/traveldata/traveldata/wsgi.py", line 14, in [Wed Dec 08 10:11:53.023327 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] from django.core.wsgi import get_wsgi_application [Wed Dec 08 10:11:53.023351 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] File "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/__init__.py", line 1, in [Wed Dec 08 10:11:53.023371 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] from django.utils.version import get_version [Wed Dec 08 10:11:53.023377 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] File "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/version.py", line 7, in [Wed Dec 08 10:11:53.023430 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] from django.utils.regex_helper import _lazy_re_compile [Wed Dec 08 10:11:53.023435 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] File "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/regex_helper.py", line 10, in [Wed Dec 08 10:11:53.023524 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] from django.utils.functional import SimpleLazyObject [Wed Dec 08 10:11:53.023529 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] File "home/kyle/active-travel/venv/lib/python3.8/site-packages/django/utils/functional.py", line 364, in [Wed Dec 08 10:11:53.023578 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] class SimpleLazyObject(LazyObject): [Wed Dec 08 10:11:53.023611 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] TypeError: Error when calling the metaclass bases [Wed Dec 08 10:11:53.023613 2021] [wsgi:error] [pid 10704:tid 140343150348032] [remote 127.0.0.1:44946] 'property' object is not callable Apache site config file: # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost Alias /static /home/kyle/active-travel/traveldata/static >>> /home/kyle/active-travel/active_travel/static> Require all granted Require all granted WSGIScriptAlias / /home/kyle