0
2021-04-29 18:44:38,475: ***************************************************
2021-04-29 18:44:38,475: If you're seeing an import error and don't know why,
2021-04-29 18:44:38,475: we have a dedicated help page to help you debug: 
2021-04-29 18:44:38,475: https://help.pythonanywhere.com/pages/DebuggingImportError/
2021-04-29 18:44:38,475: ***************************************************
2021-04-29 18:44:39,075: Error running WSGI application
2021-04-29 18:44:39,076: TypeError: 'str' object is not callable
2021-04-29 18:44:39,076:   File "/var/www/paulosix_pythonanywhere_com_wsgi.py", line 29, in <module>
2021-04-29 18:44:39,076:     application = get_wsgi_application()
2021-04-29 18:44:39,076: 
2021-04-29 18:44:39,077:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2021-04-29 18:44:39,077:     django.setup(set_prefix=False)
2021-04-29 18:44:39,077: 
2021-04-29 18:44:39,077:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
2021-04-29 18:44:39,077:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2021-04-29 18:44:39,077: 
2021-04-29 18:44:39,077:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/django/conf/__init__.py", line 82, in __getattr__
2021-04-29 18:44:39,077:     self._setup(name)
2021-04-29 18:44:39,077: 
2021-04-29 18:44:39,077:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/django/conf/__init__.py", line 69, in _setup
2021-04-29 18:44:39,077:     self._wrapped = Settings(settings_module)
2021-04-29 18:44:39,077: 
2021-04-29 18:44:39,078:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/django/conf/__init__.py", line 170, in __init__
2021-04-29 18:44:39,078:     mod = importlib.import_module(self.SETTINGS_MODULE)
2021-04-29 18:44:39,078: 
2021-04-29 18:44:39,078:   File "/home/paulosix/djangoSIGE/djangosige/configs/__init__.py", line 3, in <module>
2021-04-29 18:44:39,078:     from .settings import *
2021-04-29 18:44:39,078: 
2021-04-29 18:44:39,078:   File "/home/paulosix/djangoSIGE/djangosige/configs/settings.py", line 19, in <module>
2021-04-29 18:44:39,078:     ALLOWED_HOSTS = config('paulosix.pythonanywhere.com', 'localhost', '127.0.0.1')
2021-04-29 18:44:39,078: 
2021-04-29 18:44:39,078:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/decouple.py", line 197, in __call__
2021-04-29 18:44:39,078:     return self.config(*args, **kwargs)
2021-04-29 18:44:39,078: 
2021-04-29 18:44:39,079:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/decouple.py", line 85, in __call__
2021-04-29 18:44:39,079:     return self.get(*args, **kwargs)
2021-04-29 18:44:39,079: 
2021-04-29 18:44:39,079:   File "/home/paulosix/.virtualenvs/singe/lib/python3.8/site-packages/decouple.py", line 79, in get
2021-04-29 18:44:39,079:     return cast(value)

1 Answer 1

1

Looks like you are passing wrong arguments to the config call that is expected to return ALLOWED_HOSTS list. According to python-decouple docs the correct call to config should look like that:

ALLOWED_HOSTS = config(
    'ALLOWED_HOSTS', 
    default=['paulosix.pythonanywhere.com', 'localhost', '127.0.0.1'], 
    cast=lambda v: [s.strip() for s in v.split(',')]
)

There is a question what do you have in your .env file where python-decouple is looking for the value of ALLOWED_HOSTS in the first place.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.