San*_*ire 1 python django run-script django-extensions
我在使用django-extensions中包含的runscript命令运行脚本文件夹内的文件夹中的脚本时遇到问题。
我的项目中的文件夹结构如下:
-apps
-scripts
-syllabus
-first.py
-second.py
Run Code Online (Sandbox Code Playgroud)
文件first.py和second.py相同。
它具有django-extension runscript命令所需的运行功能。
def run(*args):
# my function call for the script.
Run Code Online (Sandbox Code Playgroud)
我已经很好地放置了init .py,并且可以从命令中运行second.py:
./manage.py runscript second --script-args=excel.xlsx
但是以某种方式我无法从runscript命令运行first.py文件。使用此命令:
./manage.py runscript first --script-args=excel.xlsx
我懂了
No (valid) module for script 'first' found
Try running with a higher verbosity level like: -v2 or -v3
我什至尝试在添加-v2和-v3结束时使用更高的详细级别。但是得到了这个错误:
No (valid) module for script 'first' found
我知道我缺少一些简单的东西,有人可以帮我吗?
您需要运行脚本,如下所示:
/manage.py runscript scripts.syllabus.first --script-args=excel.xlsx
Run Code Online (Sandbox Code Playgroud)
这里的脚本和课程提纲是两个包含的目录__init__.py。
| 归档时间: |
|
| 查看次数: |
3325 次 |
| 最近记录: |