Fork me on GitHub

django-dilla by aerosol

Ubercool DB spammer for Django

Dilla is a multi-purpose general testing tool for automated database spamming, intented to use with projects built on top of Django, populating data within any number of internal applications.

It will, simply, fill your models with lots of nicely generated random data. Not to mention, that you can easily write your own spammers for certain fields or field types. Oooooh yeah!

Use cases

Installation & usage

  1. NEW! Finally, we're on PyPI! Real men use pip, therefore you can do:

    pip install django-dilla

    Alternatively, you can download this project in either zip or tar formats.

    You can also clone the project with Git by running:

    $ git clone git://github.com/aerosol/django-dilla

    Manual installation will also require you to perform:

    python setup.py install

  2. Edit settings.py to integrate into existing Django project:

    INSTALLED_APPS = ( ...
          'myapp',
          'dilla'
      )
    
    DICTIONARY = "/usr/share/dict/words"
    DILLA_USE_LOREM_IPSUM = False # set to True ignores dictionary
    DILLA_APPS = ['myapp', 'auth']
    DILLA_EXCLUDE_MODELS = ['myapp.Comments',]
    
    
    
  3. Write some custom spammers if you need any, i.e.:
    # my_custom_spamlib.py
    
    from dilla import spam
    import string
    import random
    
    @spam.global_handler('CharField') # field.get_internal_type()
    def get_chars(field):
        return random.choice(string.ascii_letters)
    
    @spam.strict_handler('myapp.Article.title')
    def get_blog_post_title(field):
        return random.choice(string.ascii_letters)
    
    and make sure Dilla will use them (settings.py again):
    DILLA_SPAMLIBS = ['myapp.my_custom_spamlib']
    
  4. For commandline help, do:
    ./manage.py help run_dilla
  5. Time to spam!
    $ ./manage.py run_dilla --cycles=100
    Dilla is going to spam your database. Do you wish to proceed? (Y/N)Y
    Dilla finished!
        2 app(s) spammed 900 row(s) affected, 2498 field(s) filled, \
        502 field(s) ommited.
    $
    

Dependencies

Existing Django project

Identicon (optional as ImageField spammer component)

License

BSD.

Authors

Adam Rutkowski (adam at mtod org)

Contact

Adam Rutkowski (adam at mtod org)

Download