I am trying to make a custom management command as show in the docs here: 
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/

When I try to run the command from my project directory I am experiencing 
the following error:

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

Here is the file:

#event_expiration.py
from django.core.management.base import BaseCommand, CommandError
from app.models import Event
import datetime

class Command(BaseCommand):
    help = 'deletes expired events'

    def handle(self, *args, **options):

        today = datetime.datetime.now()
        events = Event.objects.filter(date=datetime.date(2011,11,11))

        for e in events:
            e.delete()

        self.stdout.write('Expired events successfully deleted.')

The command I am running is :

$ python manage.py event_expiration

I've made sure I am adding the event_expiration.py file within management 
and commands folders and that those folders have init files. those are in 
one of my app folders.

Am I overlooking something here? Any help is appreciated, thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/hG2tkLMfDO0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to