如何告诉Django永远不要使用(并完全忽略)SqlLite?

时间:2019-02-20 04:10:16

标签: django python-3.x sqlite module virtualenv

我试图用CentOS 7和Apache(Mod WSGI)使用Python 3.7获得Django应用程序。我有一个设置了虚拟环境的项目。如何关闭SqlLite?我不是也不打算永远使用它。我尝试跑步

(dentalenv) [root@server Python-3.7.2]# sudo yum install libsqlite3-dev
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.us-midwest-1.nexcess.net
 * epel: mirror.steadfastnet.com
 * extras: mirror.us-midwest-1.nexcess.net
 * updates: mirror.us-midwest-1.nexcess.net
No package libsqlite3-dev available.
Error: Nothing to do

安装它,然后重新启动我的Apache服务器。我什至重建了Python,但仍然出现以下错误“ ModuleNotFoundError:没有名为'_sqlite3'的模块”

[Wed Feb 20 04:03:06.627020 2019] [wsgi:error] [pid 11885] Traceback (most recent call last):
[Wed Feb 20 04:03:06.627285 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dental/wsgi.py", line 25, in <module>
[Wed Feb 20 04:03:06.627323 2019] [wsgi:error] [pid 11885]     application = get_wsgi_application()
[Wed Feb 20 04:03:06.627353 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Feb 20 04:03:06.627378 2019] [wsgi:error] [pid 11885]     django.setup(set_prefix=False)
[Wed Feb 20 04:03:06.627405 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
[Wed Feb 20 04:03:06.627429 2019] [wsgi:error] [pid 11885]     apps.populate(settings.INSTALLED_APPS)
[Wed Feb 20 04:03:06.627467 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/apps/registry.py", line 112, in populate
[Wed Feb 20 04:03:06.627493 2019] [wsgi:error] [pid 11885]     app_config.import_models()
[Wed Feb 20 04:03:06.627520 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/apps/config.py", line 198, in import_models
[Wed Feb 20 04:03:06.627544 2019] [wsgi:error] [pid 11885]     self.models_module = import_module(models_module_name)
[Wed Feb 20 04:03:06.627571 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Wed Feb 20 04:03:06.627608 2019] [wsgi:error] [pid 11885]     return _bootstrap._gcd_import(name[level:], package, level)
[Wed Feb 20 04:03:06.627636 2019] [wsgi:error] [pid 11885]   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
[Wed Feb 20 04:03:06.627666 2019] [wsgi:error] [pid 11885]   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
[Wed Feb 20 04:03:06.627695 2019] [wsgi:error] [pid 11885]   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
[Wed Feb 20 04:03:06.627724 2019] [wsgi:error] [pid 11885]   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
[Wed Feb 20 04:03:06.627754 2019] [wsgi:error] [pid 11885]   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
[Wed Feb 20 04:03:06.627783 2019] [wsgi:error] [pid 11885]   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Wed Feb 20 04:03:06.627812 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
[Wed Feb 20 04:03:06.627835 2019] [wsgi:error] [pid 11885]     from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
[Wed Feb 20 04:03:06.627861 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
[Wed Feb 20 04:03:06.627884 2019] [wsgi:error] [pid 11885]     class AbstractBaseUser(models.Model):
[Wed Feb 20 04:03:06.627910 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/base.py", line 101, in __new__
[Wed Feb 20 04:03:06.627933 2019] [wsgi:error] [pid 11885]     new_class.add_to_class('_meta', Options(meta, app_label))
[Wed Feb 20 04:03:06.627958 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/base.py", line 305, in add_to_class
[Wed Feb 20 04:03:06.627981 2019] [wsgi:error] [pid 11885]     value.contribute_to_class(cls, name)
[Wed Feb 20 04:03:06.628008 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/options.py", line 203, in contribute_to_class
[Wed Feb 20 04:03:06.628031 2019] [wsgi:error] [pid 11885]     self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
[Wed Feb 20 04:03:06.628058 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/__init__.py", line 33, in __getattr__
[Wed Feb 20 04:03:06.628081 2019] [wsgi:error] [pid 11885]     return getattr(connections[DEFAULT_DB_ALIAS], item)
[Wed Feb 20 04:03:06.628107 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/utils.py", line 202, in __getitem__
[Wed Feb 20 04:03:06.628132 2019] [wsgi:error] [pid 11885]     backend = load_backend(db['ENGINE'])
[Wed Feb 20 04:03:06.628159 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
[Wed Feb 20 04:03:06.628193 2019] [wsgi:error] [pid 11885]     return import_module('%s.base' % backend_name)
[Wed Feb 20 04:03:06.628222 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Wed Feb 20 04:03:06.628243 2019] [wsgi:error] [pid 11885]     return _bootstrap._gcd_import(name[level:], package, level)
[Wed Feb 20 04:03:06.628264 2019] [wsgi:error] [pid 11885]   File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 10, in <module>
[Wed Feb 20 04:03:06.628283 2019] [wsgi:error] [pid 11885]     from sqlite3 import dbapi2 as Database
[Wed Feb 20 04:03:06.628304 2019] [wsgi:error] [pid 11885]   File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
[Wed Feb 20 04:03:06.628323 2019] [wsgi:error] [pid 11885]     from sqlite3.dbapi2 import *
[Wed Feb 20 04:03:06.628344 2019] [wsgi:error] [pid 11885]   File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
[Wed Feb 20 04:03:06.628369 2019] [wsgi:error] [pid 11885]     from _sqlite3 import *
[Wed Feb 20 04:03:06.628408 2019] [wsgi:error] [pid 11885] ModuleNotFoundError: No module named '_sqlite3'
[Wed Feb 20 04:03:09.130480 2019] [wsgi:error] [pid 11885] [remote 207.181.224.155:58106] mod_wsgi (pid=11885): Target WSGI script '/var/www/html/dental/wsgi.py' does not contain WSGI application 'application'.

0 个答案:

没有答案
相关问题