Fetching contributors…
Cannot retrieve contributors at this time
91 lines (58 sloc) 3.05 KB

General Tips

Next you can find some general Varnish Bans Manager (VBM) development tips. These are only useful for developers when setting up their development environment.

  • Check out and install all required dependencies.

  • Use VARNISH_BANS_MANAGER_CONF environment variable to point to your personal configuration file. Also remember to:

    • Set development to true in your personal configuration.

    • Disable http > daemon in your personal configuration if developing using Gunicorn:

      $ python varnish_bans_manager/ start
    • Use --nothreading if using Django embedded HTTP server:

      $ python varnish_bans_manager/ runserver --nothreading
    • Initialize database schema:

      $ python varnish_bans_manager/ migrate
      $ python varnish_bans_manager/ createcachetable cache
    • Create the first VBM administrator. You'll be able to add extra users later using the web UI:

      $ python varnish_bans_manager/ users --add --administrator --email "" --password "s3cr3t" --firstname "Bob" --lastname "Brown"
  • Install Sass and Compass in your development box (required by django-mediagenerator asset manager):

    $ sudo apt-get install rubygems
    $ sudo gem install sass compass
  • Don't forget to manually launch celeryd/celerybeat in some available term/screen while developing:

    $ celery -A varnish_bans_manager worker -B -s ~/varnish-bans-manager-celerybeat-schedule --loglevel=info
  • Remember to install the packages required by your relational database backend. For example, for MySQL:

    $ pip install MySQL-python
  • While developing, press CTRL+ALT+A in your browser to display the VBM debug console.

  • Remember .po files can be regenerated and compiled using the following commands:

    $ python varnish_bans_manager/ makemessages -l es -e "html,txt,email,py"
    $ python varnish_bans_manager/ compilemessages

Source Distribution Package

VBM sources require a build step previous to the generation of the Python source distribution package. During this phase SASS sources are compiled to CSS, some Javascript and CSS bundles are created, static contents are versioned, translation files are compiled, etc.

In order to execute this site building phase and then generate the Python source distribution package, simply run the following command in the root folder of the VBM sources:

$ make sdist

Note that the site building phase has some extra system requirements:

  • YUI Compressor and some Java Runtime Environment:

    $ export YUICOMPRESSOR_PATH="/path/to/yuicompressor.jar"
    $ sudo apt-get install openjdk-7-jre
  • GNU internationalization utilities. In Ubuntu:

    $ sudo apt-get install gettext


  • Ban templates.
  • Refactor varnish_bans_manager.filesystem.models.
  • Locale-aware application level ordering.