django 启动报错 同一个项目 放到A电脑没问题 B电脑就报错 且DEBUG找不到这个问题
Traceback (most recent call last):
File "D:/py/1S1K/spider_one_dow/manage.py", line 21, in <module>
main()
File "D:/py/1S1K/spider_one_dow/manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "D:anacondalibsite-packagesdjangocoremanagement__init__.py", line 381, in execute_from_command_line
utility.execute()
File "D:anacondalibsite-packagesdjangocoremanagement__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:anacondalibsite-packagesdjangocoremanagementbase.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "D:anacondalibsite-packagesdjangocoremanagementcommandsrunserver.py", line 60, in execute
super().execute(*args, **options)
File "D:anacondalibsite-packagesdjangocoremanagementbase.py", line 364, in execute
output = self.handle(*args, **options)
File "D:anacondalibsite-packagesdjangocoremanagementcommandsrunserver.py", line 95, in handle
self.run(**options)
File "D:anacondalibsite-packagesdjangocoremanagementcommandsrunserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 585, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 570, in start_django
reloader.run(django_main_thread)
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 288, in run
self.run_loop()
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 294, in run_loop
next(ticker)
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 334, in tick
for filepath, mtime in self.snapshot_files():
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 350, in snapshot_files
for file in self.watched_files():
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 249, in watched_files
yield from iter_all_python_module_files()
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 103, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 116, in iter_modules_and_files
if module.__name__ == '__main__':
File "D:anacondalibsite-packagespy_apipkg.py", line 171, in getattribute
return getattr(getmod(), name)
File "D:anacondalibsite-packagespy_error.py", line 44, in getattr
raise AttributeError(name)
AttributeError: name
回答:
已经解决 应该不是版本问题 debug发现主要问题出现
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 103, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "D:anacondalibsite-packagesdjangoutilsautoreload.py", line 116, in iter_modules_and_files
if module.__name__ == '__main__':
这两句话 网上查找 发现是自查模块的方法 然后我直接修改的源码 删除了这部分代码 (请不要学习我的操作)
然后没有报错 django也没有任何问题 初步怀疑 可能是django版本和anaconda冲突???
没有时间去深入了解 写下这个问题 防止后面入坑的同学
回答:
用的什么方式启动的?排错先用python来启动,再配成uwsgi启动
python manage.py runserver 0.0.0.0:8000
看看报什么错,定位问题
回答:
换个低一点的django试试
以上是 django 启动报错 同一个项目 放到A电脑没问题 B电脑就报错 且DEBUG找不到这个问题 的全部内容, 来源链接: utcz.com/a/156816.html