宝塔用户_gluhit 发表于 2024-8-27 10:14:43

【待反馈】网站中的新建的Python项目无法启动?

之前的项目在软件:python项目管理器2.0中运行的,然后更换到宝塔面板中的网站-python项目。
项目搭建之后可以正常启动,但是浏览器访问提示Internal server error:

项目配置如下:域名于外网映射都已经配置了。


使用浏览器访问搭建的域名提示:


日志报错信息如下:
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/contrib/auth/models.py", line 3, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/contrib/auth/base_user.py", line 59, in <module>
class AbstractBaseUser(models.Model):
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/db/models/base.py", line 143, in __new__
new_class.add_to_class("_meta", Options(meta, app_label))
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/db/models/base.py", line 371, in add_to_class
value.contribute_to_class(cls, name)
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/db/models/options.py", line 243, in contribute_to_class
self.db_table, connection.ops.max_name_length()
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/utils/connection.py", line 15, in __getattr__
return getattr(self._connections, item)
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/utils/connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/db/utils.py", line 193, in create_connection
backend = load_backend(db["ENGINE"])
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/db/utils.py", line 113, in load_backend
return import_module("%s.base" % backend_name)
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name, package, level)
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/django/db/backends/mysql/base.py", line 16, in <module>
import MySQLdb as Database
File "/www/server/pyporject_evn/lmew_venv/lib/python3.10/site-packages/MySQLdb/__init__.py", line 24, in <module>
version_info, _mysql.version_info, _mysql.__file__
NameError: name '_mysql' is not defined
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 31029)
spawned uWSGI worker 1 (pid: 31030, cores: 2)
spawned uWSGI worker 2 (pid: 31032, cores: 2)
spawned uWSGI worker 3 (pid: 31033, cores: 2)
spawned uWSGI worker 4 (pid: 31035, cores: 2)
spawned uWSGI http 1 (pid: 31037)
--- no python application found, check your startup logs for errors ---
127.0.0.1 () {48 vars in 837 bytes} GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
--- no python application found, check your startup logs for errors ---
127.0.0.1 () {48 vars in 837 bytes} GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 1)项目所需要的库我都安装完成了,虽然能启动但是还是报错,并且访问就是500状态,求管理员帮忙看看是什么问题。


运维技术阿闯 发表于 2024-8-27 11:26:42

您好,项目问题我们无法解决,您这个应该是您项目无法导入名为'_mysql'的模块
以及 Django 无法找到或加载你的应用
页: [1]
查看完整版本: 【待反馈】网站中的新建的Python项目无法启动?