如何在Django服务器的开始打印ascii横幅?

2024-10-04 07:35:01 发布

您现在位置:Python中文网/ 问答频道 /正文

使用以下命令启动Django服务器时,如何在控制台上打印ASCII艺术横幅:

python manage.py runserver

类似于下面这个: enter image description here

参考文献:Ajin Abraham MobSF https://github.com/MobSF/Mobile-Security-Framework-MobSF/wiki/1.-Documentation

有没有办法钩住runserver命令?在


Tags: djangopyhttps命令githubmanageascii艺术
2条回答

在您的manage.py中添加此横幅可能很难看,但不会有风险:

# near the end
if 'runserver' in sys.argv:
    print('This is my banner')
execute_from_command_line(sys.argv)
# end

我想,我自己找到了答案。在

我在网址.py,它在服务器启动上运行。在

网址.py

...
print """ My Banner """
...

相关问题 更多 >