简体   繁体   English

如何在 django 中恢复 views.py 文件?

[英]How to recover the views.py file in django?

I am using Django on Linux and am currently completing the tutorial, but a case of human error occurred.我在 Linux 上使用 Django,目前正在完成本教程,但发生了人为错误。 I accidentally deleted the views.py file (in tutorial is in the polls directory) and it would really help if anyone knew a way to reinstall the files, or if it is even necessary in the first place.我不小心删除了views.py文件(在教程中是在 polls 目录中),如果有人知道重新安装文件的方法,或者如果它是必要的,那真的很有帮助。 I'm new to Django, so please keep that in mind.我是 Django 的新手,所以请记住这一点。 Thank you.谢谢你。

The views.py doesn't contain anything until you write it.在您编写它之前, views.py 不包含任何内容。 If you hadn't written anything yet, then just create a new empty file and call it views.py.如果您还没有写任何东西,那么只需创建一个新的空文件并将其命名为 views.py。

In future, you should always use source control.将来,您应该始终使用源代码控制。

Hope this will help you https://github.com/wibiti/uncompyle2希望这会帮助你https://github.com/wibiti/uncompyle2

See this answer on uncompyle2 for some other comments.有关其他一些评论,请参阅 uncompyle2 上的此答案

There is no way of getting back the files.没有办法取回文件。 They are deleted.它们被删除。

You could try a program that scans for deleted files, but don't count on it.您可以尝试使用扫描已删除文件的程序,但不要指望它。

Source control and frequent backups are the best methods of preventing this problem in the future.源代码控制和频繁备份是防止将来出现此问题的最佳方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM