D:\mysite> py manage.py shell
Traceback (most recent call last):
File "manage.py", line 22, in
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\python\lib\site-packages\django\core\management_init.py", line 419, in execute_from_command_line
utility.execute()
File "C:\python\lib\site-packages\django\core\management_init.py", line 395, in execute
django.setup()
File "C:\python\lib\site-packages\django_init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\python\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\python\lib\site-packages\django\apps\config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
File "C:\python\lib\importlib_init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 724, in exec_module
File "", line 860, in get_code
File "", line 791, in source_to_code
File "", line 219, in _call_with_frames_removed
File "D:\mysite\polls\models.py", line 22
def str(self):
^
IndentationError: unexpected indent
如果是创建的django文件代码缩进有问题可以改,但是c盘都是源文件代码,没有改过,怎么会提示代码缩进错误提示呀,请教各位技术大咖,这个怎么改进呀。
运行py manage.py shell命令时出现错误
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- CSDN专家-HGJ 2021-07-12 14:06关注
错误提示是models.py代码中第22行有缩进错误,你检查一下看看这个文件,是不是复制粘贴造成的,将def str(self)按代码逻辑调整缩进和对齐,通过del空格和tab缩进消除不可见字符。
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥30 关于#java#的问题,请各位专家解答!
- ¥20 pcf8563时钟芯片不启振
- ¥20 pip2.40更新pip2.43时报错
- ¥15 换yum源但仍然用不了httpd
- ¥50 C# 使用DEVMOD设置打印机首选项
- ¥15 麒麟V10 arm安装gdal
- ¥20 OPENVPN连接问题
- ¥15 flask实现搜索框访问数据库
- ¥15 mrk3399刷完安卓11后投屏调试只能显示一个设备
- ¥100 如何用js写一个游戏云存档