django - 如何在 django 应用程序中调用 collectstatic 例程?
问题描述
我的 Django 应用程序使用 css/html 主题,我可以从用户界面上传新主题,也就是说,普通用户可以上传新主题而无需 IT 人员。我通常调用 os.run('python manage.py collectstatic') 但我想知道是否有可能以更优雅或 Pythonic 的方式进行。
解决方案
您可以使用call_command(...)
--(doc)作为,
from django.core import management
management.call_command("collectstatic")
推荐阅读
- outlook - 运行时 Outlook 变为白色 Process.Start("Outlook.exe", "/recycle")
- c++ - 如何在 MFC 中保存 .wav 文件(使用文件对话框)
- r - 关系和条件数据编码
- java - 是否可以在 Java 的 print 语句中添加 sleep() 方法?
- html - (Laravel)如何将 ajax 成功回调值传递给 ConsoleTv 图表?
- django - 根据文件类型显示图标
- c++ - Eigen::LLT< Eigen::MatrixXd > 类型不完整
- arduino - 如何使millis()在arduino中精确计算1秒?
- c# - C#8 中的数组和字符串通过哪个标准范围应用?
- javascript - 键入时保留输入的占位符文本