0

I have just downloaded the collectmedia snippet from http://djangosnippets.org/snippets/1068/ but im not sure how to go about using it.

Where do i have to put it and how do i call it?

I now have:

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

collectmedia shows up when i run ./manage.py -h but when i try to run it with :

./manage.py collectmedia

i get this error:

AttributeError: 'module' object has no attribute 'Command'
Calum
  • 2,110
  • 2
  • 22
  • 39
  • In the upper right hand corner of that page you are given instructions. Place the file in `yourapp/management/commands/collectmedia.py` and run `manage.py collectmedia`. Or you can run `manage.py help collectmedia` for more options. Have you tried this? – Dan Hoerst Jan 23 '13 at 03:21

1 Answers1

0

Copy the file and put it in a folder like:

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

Run

./manage.py collectmedia

Also note:

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.
Nick
  • 474
  • 1
  • 3
  • 14
  • thanks i completely missed that. still not getting it running though, what should the contents of __init__.py be?, from collectmedia import * ? – Calum Jan 23 '13 at 04:05
  • Just a blank file so that django recognizes it as a python module. – Nick Jan 23 '13 at 04:31