Internal Server Error
重新查看nginx和uwsgi配置,再次重启nginx和uwsgi,发现还是一样的状况,但是访问项目的静态文件时成功的,查看uwsgi中设置的log文件
Traceback (most recent call last):
File "./dailyfresh/wsgi.py", line 16, in
application = get_wsgi_application()
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/django/conf/__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'settings_production'
unable to load app 0 (mountpoint='') (callable not found or import error)
找到原因。项目的wsgi.py文件中settings引用错误,修改后重新启动uwsgi,遇到这个问题,不多说找到代码直接注掉
load_backend
return import_module('%s.base' % backend_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 36, in
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
注掉后重启uwsgi(还有个地方将decode修改为encode的),
查看uwsgi的日志文件,明白了,当时使用了jieba分词器,修改了haystack底层代码,额外建了一个文件并没有上传到服务器上。
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/haystack/query.py", line 29, in __init__
self._determine_backend()
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/haystack/query.py", line 62, in _determine_backend
self.query = connections[backend_alias].get_query()
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/haystack/utils/loading.py", line 109, in __getitem__
self.thread_local.connections[key] = load_backend(self.connections_info[key]['ENGINE'])(using=key)
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/haystack/utils/loading.py", line 60, in load_backend
return import_class(full_backend_path)
File "/zt_dailyfresh/dailyfresh_env/lib/python3.6/site-packages/haystack/utils/loading.py", line 27, in import_class
module_itself = importlib.import_module(module_path)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'haystack.backends.whoosh_cn_backend'
上传相关文件后,访问服务器ip
还有个问题,我的数据库还没有建表,建表后。
decode修改为encode
\lib\site-packages\django\db\backends\mysql\operations.py”, line 146, in last_executed_query
query = query.decode(errors=‘replace’)
AttributeError: ‘str’ object has no attribute ‘decode’
成功。