Issue
I've been stuck in this django apache deployment. When I try to deploy my web page with linode(Linux base server) and tries to access to it, my website keeps showing this 500 Internal Server error. It happens after I ran this in my venv shell.
$ sudo service apache2 restart
Since the web page suggest that I look into log file, which I did, I found I have mod wsgi issue. Here is my log file.
[Fri Feb 14 06:43:49.388284 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] mod_wsgi (pid=26679): Target WSGI script '/home/harryghgim/django_project/django_project/wsgi.py' cannot be loaded as Python module.
[Fri Feb 14 06:43:49.388369 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] mod_wsgi (pid=26679): Exception occurred processing WSGI script '/home/harryghgim/django_project/django_project/wsgi.py'.
[Fri Feb 14 06:43:49.388622 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] Traceback (most recent call last):
[Fri Feb 14 06:43:49.388720 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/django_project/wsgi.py", line 16, in <module>
[Fri Feb 14 06:43:49.388726 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] application = get_wsgi_application()
[Fri Feb 14 06:43:49.388734 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Fri Feb 14 06:43:49.388739 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] django.setup(set_prefix=False)
[Fri Feb 14 06:43:49.388745 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
[Fri Feb 14 06:43:49.388750 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Fri Feb 14 06:43:49.388757 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__
[Fri Feb 14 06:43:49.388760 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] self._setup(name)
[Fri Feb 14 06:43:49.388766 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup
[Fri Feb 14 06:43:49.388770 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] self._wrapped = Settings(settings_module)
[Fri Feb 14 06:43:49.388777 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__
[Fri Feb 14 06:43:49.388781 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] mod = importlib.import_module(self.SETTINGS_MODULE)
[Fri Feb 14 06:43:49.388787 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
[Fri Feb 14 06:43:49.388790 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] return _bootstrap._gcd_import(name[level:], package, level)
[Fri Feb 14 06:43:49.388813 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[Fri Feb 14 06:43:49.388820 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[Fri Feb 14 06:43:49.388826 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
[Fri Feb 14 06:43:49.388832 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
[Fri Feb 14 06:43:49.388837 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap_external>", line 678, in exec_module
[Fri Feb 14 06:43:49.388843 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Fri Feb 14 06:43:49.388850 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/django_project/settings.py", line 17, in <module>
[Fri Feb 14 06:43:49.388853 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] config = json.load(config_file)
[Fri Feb 14 06:43:49.388859 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/__init__.py", line 299, in load
[Fri Feb 14 06:43:49.388862 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
[Fri Feb 14 06:43:49.388867 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
[Fri Feb 14 06:43:49.388871 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] return _default_decoder.decode(s)
[Fri Feb 14 06:43:49.388876 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
[Fri Feb 14 06:43:49.388879 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Fri Feb 14 06:43:49.388886 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode
[Fri Feb 14 06:43:49.388889 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] obj, end = self.scan_once(s, idx)
[Fri Feb 14 06:43:49.388909 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 5 column 1 (char 129)
I'm sorry for this long log file. Can anyone tell me how to fix this issue?
edit
This is my wsgi.py file at /home/harryghgim/django_project/django_project/wsgi.py
""" WSGI config for django_project project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """
import os from django.core.wsgi
import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
application = get_wsgi_application()
This is my virtual host setting at /etc/apache2/sites-available/django_project.conf
Alias /static /home/harryghgim/django_project/static
<Directory /home/harryghgim/django_project/static>
Require all granted
</Directory>
Alias /media /home/harryghgim/django_project/media
<Directory /home/harryghgim/django_project/media>
Require all granted
</Directory>
<Directory /home/harryghgim/django_project/django_project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/harryghgim/django_project/django_project/wsgi.py
WSGIDaemonProcess django_app python-path=/home/harryghgim/django_project python-home=/home/harryghgim/django_project/venv
WSGIProcessGroup django_app
Should I change any of these to fix the problem?
EDITED #2
Since it's giving me huge suffering, I rather decided to run another linux server with slightly different username and server name. And greatly I have the same issue. This time I'll try to put it neat and tidy.
[Sat Feb 15 06:55:00.657722 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] mod_wsgi (pid=3546): Failed to exec Python script file '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.658894 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] mod_wsgi (pid=3546): Exception occurred processing WSGI script '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.659151 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] Traceback (most recent call last):
[Sat Feb 15 06:55:00.659254 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/django_project/wsgi.py", line 16, in <module>
[Sat Feb 15 06:55:00.659291 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] application = get_wsgi_application()
[Sat Feb 15 06:55:00.659319 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sat Feb 15 06:55:00.659324 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] django.setup(set_prefix=False)
[Sat Feb 15 06:55:00.659331 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
[Sat Feb 15 06:55:00.659335 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Sat Feb 15 06:55:00.659341 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
[Sat Feb 15 06:55:00.659346 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] self._setup(name)
[Sat Feb 15 06:55:00.659351 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
[Sat Feb 15 06:55:00.659355 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] self._wrapped = Settings(settings_module)
[Sat Feb 15 06:55:00.659361 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
[Sat Feb 15 06:55:00.659365 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] mod = importlib.import_module(self.SETTINGS_MODULE)
[Sat Feb 15 06:55:00.659371 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Sat Feb 15 06:55:00.659375 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] return _bootstrap._gcd_import(name[level:], package, level)
[Sat Feb 15 06:55:00.659392 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
[Sat Feb 15 06:55:00.659398 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 983, in _find_and_load
[Sat Feb 15 06:55:00.659404 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
[Sat Feb 15 06:55:00.659409 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
[Sat Feb 15 06:55:00.659415 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap_external>", line 728, in exec_module
[Sat Feb 15 06:55:00.659420 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Sat Feb 15 06:55:00.659426 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/django_project/settings.py", line 17, in <module>
[Sat Feb 15 06:55:00.659430 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] config = json.load(config_file)
[Sat Feb 15 06:55:00.659435 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/__init__.py", line 296, in load
[Sat Feb 15 06:55:00.659439 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
[Sat Feb 15 06:55:00.659444 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
[Sat Feb 15 06:55:00.659448 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] return _default_decoder.decode(s)
[Sat Feb 15 06:55:00.659453 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
[Sat Feb 15 06:55:00.659457 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Sat Feb 15 06:55:00.659462 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
[Sat Feb 15 06:55:00.659466 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] obj, end = self.scan_once(s, idx)
[Sat Feb 15 06:55:00.659484 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 130)
[Sat Feb 15 06:55:00.850305 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] mod_wsgi (pid=3546): Failed to exec Python script file '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.850350 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] mod_wsgi (pid=3546): Exception occurred processing WSGI script '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.850563 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] Traceback (most recent call last):
[Sat Feb 15 06:55:00.850634 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/django_project/wsgi.py", line 16, in <module>
[Sat Feb 15 06:55:00.850639 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] application = get_wsgi_application()
[Sat Feb 15 06:55:00.850646 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sat Feb 15 06:55:00.850663 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] django.setup(set_prefix=False)
[Sat Feb 15 06:55:00.850683 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
[Sat Feb 15 06:55:00.850687 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Sat Feb 15 06:55:00.850693 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
[Sat Feb 15 06:55:00.850697 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] self._setup(name)
[Sat Feb 15 06:55:00.850702 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
[Sat Feb 15 06:55:00.850706 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] self._wrapped = Settings(settings_module)
[Sat Feb 15 06:55:00.850711 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
[Sat Feb 15 06:55:00.850715 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] mod = importlib.import_module(self.SETTINGS_MODULE)
[Sat Feb 15 06:55:00.850721 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Sat Feb 15 06:55:00.850724 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] return _bootstrap._gcd_import(name[level:], package, level)
[Sat Feb 15 06:55:00.850730 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
[Sat Feb 15 06:55:00.850735 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 983, in _find_and_load
[Sat Feb 15 06:55:00.850741 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
[Sat Feb 15 06:55:00.850747 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
[Sat Feb 15 06:55:00.850752 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap_external>", line 728, in exec_module
[Sat Feb 15 06:55:00.850758 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Sat Feb 15 06:55:00.850763 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/django_project/settings.py", line 17, in <module>
[Sat Feb 15 06:55:00.850767 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] config = json.load(config_file)
[Sat Feb 15 06:55:00.850772 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/__init__.py", line 296, in load
[Sat Feb 15 06:55:00.850776 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
[Sat Feb 15 06:55:00.850781 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
[Sat Feb 15 06:55:00.850785 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] return _default_decoder.decode(s)
[Sat Feb 15 06:55:00.850794 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
[Sat Feb 15 06:55:00.850798 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Sat Feb 15 06:55:00.850803 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
[Sat Feb 15 06:55:00.850807 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] obj, end = self.scan_once(s, idx)
[Sat Feb 15 06:55:00.850824 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 130)
I checked project folder permission and www-data thing. Here's my code.
djtu@dj-serv:~/django_project$ ls -la
total 228
drwxr-xr-x 8 djtu www-data 4096 Feb 15 06:13 .
drwxr-xr-x 7 djtu djtu 4096 Feb 15 06:55 ..
-rw-r--r-- 1 djtu djtu 6148 Feb 15 05:56 .DS_Store
drwxr-xr-x 6 djtu djtu 4096 Feb 15 05:56 blog
-rw-rw-r-- 1 djtu www-data 167936 Feb 15 06:13 db.sqlite3
drwxr-xr-x 3 djtu djtu 4096 Feb 15 06:48 django_project
-rw-r--r-- 1 djtu djtu 634 Feb 15 05:56 manage.py
drwxrwxr-x 3 djtu www-data 4096 Feb 15 05:56 media
-rw-r--r-- 1 djtu djtu 13994 Feb 15 05:56 posts.json
-rw-r--r-- 1 djtu djtu 624 Feb 15 05:56 requirements.txt
drwxrwxr-x 4 djtu djtu 4096 Feb 15 06:08 static
drwxr-xr-x 5 djtu djtu 4096 Feb 15 05:56 users
drwxrwxr-x 6 djtu djtu 4096 Feb 15 06:00 venv
I also checked mod_wsgi
was enabled. Here is the screenshot:
Just in case, I'm also putting manage.py file to see if the file is any messed up or something.
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
Also I did python manage.py check
in my project folder and this is shown below.
(venv) djtu@dj-serv:~/django_project$ python manage.py check
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 345, in execute
settings.INSTALLED_APPS
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
self._setup(name)
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/djtu/django_project/django_project/settings.py", line 17, in <module>
config = json.load(config_file)
File "/usr/lib/python3.7/json/__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 130)
Here is my machine information: Apache/2.4.41 (Ubuntu 19.10) for server and virtual host Python 3.7.5 and Django 3.0.2
Solution
I messed up with json file format. I shouldn't have put comma at the end of data. Instead this,
{"key1":"value1", "key2":"value2", "key3":"value3",}
I set as follows.
{"key1":"value1", "key2":"value2", "key3":"value3"}
And it worked beautifully.
Answered By - harryghgim
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.