Issues with deploying Django web app to PythonAnywhere

In the final task for the ‘Build Python Web Apps with Django Skill Path’, I need to deploy my djangovet app on PythonAnywhere.

Following the Codecademy’s tutorial carefully, when I try to access my website, it responds with: “Something went wrong :-(”

Checking the error log, I can see the following:

022-05-31 11:57:55,772: Error running WSGI application
2022-05-31 11:57:55,773: json.decoder.JSONDecodeError: Expecting value: line 2 column 17 (char 18)
2022-05-31 11:57:55,773: File “/var/www/gulaidahmed_pythonanywhere_com_wsgi.py”, line 23, in
2022-05-31 11:57:55,773: application = get_wsgi_application()
2022-05-31 11:57:55,773:
2022-05-31 11:57:55,773: File “/home/gulaidahmed/.virtualenvs/myapp/lib/python3.8/site-packages/django/core/wsgi.py”, line 12, in get_wsgi_application
2022-05-31 11:57:55,773: django.setup(set_prefix=False)
2022-05-31 11:57:55,774:
2022-05-31 11:57:55,774: File “/home/gulaidahmed/.virtualenvs/myapp/lib/python3.8/site-packages/django/init.py”, line 19, in setup
2022-05-31 11:57:55,774: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2022-05-31 11:57:55,774:
2022-05-31 11:57:55,774: File “/home/gulaidahmed/.virtualenvs/myapp/lib/python3.8/site-packages/django/conf/init.py”, line 82, in getattr
2022-05-31 11:57:55,774: self._setup(name)
2022-05-31 11:57:55,774:
2022-05-31 11:57:55,774: File “/home/gulaidahmed/.virtualenvs/myapp/lib/python3.8/site-packages/django/conf/init.py”, line 69, in _setup
2022-05-31 11:57:55,774: self._wrapped = Settings(settings_module)
2022-05-31 11:57:55,774:
2022-05-31 11:57:55,774: File “/home/gulaidahmed/.virtualenvs/myapp/lib/python3.8/site-packages/django/conf/init.py”, line 170, in init
2022-05-31 11:57:55,775: mod = importlib.import_module(self.SETTINGS_MODULE)
2022-05-31 11:57:55,775:
2022-05-31 11:57:55,775: File “./djangovet/settings.py”, line 22, in
2022-05-31 11:57:55,775: project_keys = json.loads(k.read())
2022-05-31 11:57:55,775:
2022-05-31 11:57:55,775: File “/usr/lib/python3.8/json/init.py”, line 357, in loads
2022-05-31 11:57:55,775: return _default_decoder.decode(s)
2022-05-31 11:57:55,775:
2022-05-31 11:57:55,776: File “/usr/lib/python3.8/json/decoder.py”, line 337, in decode
2022-05-31 11:57:55,776: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2022-05-31 11:57:55,776:
2022-05-31 11:57:55,776: File “/usr/lib/python3.8/json/decoder.py”, line 355, in raw_decode
2022-05-31 11:57:55,776: raise JSONDecodeError(“Expecting value”, s, err.value) from None
2022-05-31 11:57:55,776: ***************************************************
2022-05-31 11:57:55,776: If you’re seeing an import error and don’t know why,
2022-05-31 11:57:55,777: we have a dedicated help page to help you debug:
2022-05-31 11:57:55,777: Debugging with sys.path / ImportError issues | PythonAnywhere help
2022-05-31 11:57:55,777: ***************************************************

I go back to the Codecademy tutorial and find the wsgi configuraion file but have no idea what the “json.decoder.JSONDecodeError: Expecting value: line 2 column 17 (char 18)” error means.

Thanks for reading this post and would appreciate any help you can provide!

Re: quote=“gulaid_ahmed, post:1, topic:674937”]
“json.decoder.JSONDecodeError
[/quote]
What are the quotes you used for the json secret key value? In python my understanding is that ’ = " However I had to change my ’ to " for the value of secretekey in JSON for it to work. I hope that helps.

1 Like

yes! it worked for me! I had same error