0

我刚刚从http://djangosnippets.org/snippets/1068/下载了 collectmedia 片段,但我不确定如何使用它。

我必须把它放在哪里,我该如何称呼它?

我现在有:

- project
    - manage.py
    - mysite
- app
- management
    - commands
    - __init__.py
        - collectmedia.py
        - __init__.py

collectmedia 在我运行 ./manage.py -h 时出现,但当我尝试使用以下命令运行它时:

./manage.py collectmedia

我收到此错误:

AttributeError: 'module' object has no attribute 'Command'
4

1 回答 1

0

复制文件并将其放在如下文件夹中:

-- your app /
---- management /
------- commands /
---------- __init__.py
---------- collectmedia.py

./manage.py collectmedia

另请注意:

This command includes an interactive mode (-i or --interactive) and a dry run mode (-n or --dry-run) for previewing what will happen. See manage.py help collectmedia for more options.
于 2013-01-23T03:25:03.327 回答