From e29646a94714d516d52272fc83d9a15bbc21e488 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Sat, 27 Dec 2014 13:52:45 +0100
Subject: [PATCH 01/13] initial version

---
 .gitignore       |  2 ++
 __init__.py      |  0
 celeryrouters.py | 24 ++++++++++++++++++++++++
 3 files changed, 26 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 __init__.py
 create mode 100644 celeryrouters.py

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3bb2efd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.*.swp
+*.pyc
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/celeryrouters.py b/celeryrouters.py
new file mode 100644
index 0000000..e468813
--- /dev/null
+++ b/celeryrouters.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+
+class LdapRouter(object):
+
+    def route_for_task(self, task, args=None, kwargs=None):
+        if 'ldap' in task:
+            return {'exchange': 'ldap',
+                    'exchange_type': 'direct',
+                    'queue': 'ldap'}
+        return None
+
+
+class FileRouter(object):
+
+    def route_for_task(self, task, args=None, kwargs=None):
+        if 'file' in task:
+            return {'exchange': 'file',
+                    'exchange_type': 'direct',
+                    'queue': 'file'}
+        return None
+
+

From 1ef49fbebcb9bf966e5dd4f7bccf3f56a35bb606 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 14:45:14 +0100
Subject: [PATCH 02/13] remove Django dependencies

---
 requirements/base.txt  | 3 ---
 requirements/local.txt | 1 -
 2 files changed, 4 deletions(-)

diff --git a/requirements/base.txt b/requirements/base.txt
index c4aa5c8..f131562 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -1,11 +1,8 @@
-Django==1.7.1
 amqp==1.4.6
 bpython==0.13.1
 anyjson==0.3.3
-argparse==1.2.1
 billiard==3.3.0.19
 celery==3.1.17
 kombu==3.0.24
 pytz==2014.10
-wsgiref==0.1.2
 mysqlclient==1.3.4
diff --git a/requirements/local.txt b/requirements/local.txt
index 4bdfc63..d0cecd4 100644
--- a/requirements/local.txt
+++ b/requirements/local.txt
@@ -1,7 +1,6 @@
 # Local development dependencies go here
 -r base.txt
 coverage==3.7.1
-django-debug-toolbar==1.2.2
 Sphinx==1.2.3
 sqlparse==0.1.14
 releases==0.7.0

From e79d58d8864750cae977645d082d8a27824ef787 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 16:01:49 +0100
Subject: [PATCH 03/13] remove Django stuff, gvamysql is a celery only
 application

---
 docs/__init__.py                         |   1 -
 docs/changelog.rst                       |   1 +
 docs/code.rst                            |  39 +--
 docs/conf.py                             |   6 -
 docs/install.rst                         |   3 +-
 gvamysql/gvamysql/celery.py              |  12 +-
 gvamysql/gvamysql/settings.py            |  48 ++++
 gvamysql/gvamysql/settings/__init__.py   |   3 -
 gvamysql/gvamysql/settings/base.py       | 294 -----------------------
 gvamysql/gvamysql/settings/local.py      |  51 ----
 gvamysql/gvamysql/settings/production.py |  50 ----
 gvamysql/gvamysql/settings/test.py       |  20 --
 gvamysql/gvamysql/urls.py                |  25 --
 gvamysql/manage.py                       |  10 -
 gvamysql/mysqltasks/models.py            |   3 -
 gvamysql/mysqltasks/tasks.py             |   2 -
 16 files changed, 53 insertions(+), 515 deletions(-)
 create mode 100644 gvamysql/gvamysql/settings.py
 delete mode 100644 gvamysql/gvamysql/settings/__init__.py
 delete mode 100644 gvamysql/gvamysql/settings/base.py
 delete mode 100644 gvamysql/gvamysql/settings/local.py
 delete mode 100644 gvamysql/gvamysql/settings/production.py
 delete mode 100644 gvamysql/gvamysql/settings/test.py
 delete mode 100644 gvamysql/gvamysql/urls.py
 delete mode 100755 gvamysql/manage.py
 delete mode 100644 gvamysql/mysqltasks/models.py

diff --git a/docs/__init__.py b/docs/__init__.py
index 8772c82..e69de29 100644
--- a/docs/__init__.py
+++ b/docs/__init__.py
@@ -1 +0,0 @@
-# Included so that Django's startproject comment runs against the docs directory
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 38ff556..eb784c5 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,3 +1,4 @@
 Changelog
 =========
 
+* feature:`-` initial project setup
diff --git a/docs/code.rst b/docs/code.rst
index 34709f1..9f1b90b 100644
--- a/docs/code.rst
+++ b/docs/code.rst
@@ -2,11 +2,8 @@
 Code documentation
 ==================
 
-.. index:: Django
+gvamysql is implemented as `Celery`_ app.
 
-gvamysql is implemented as `Django`_ project and provides some `Celery`_ tasks.
-
-.. _Django: https://www.djangoproject.com/
 .. _Celery: http://www.celeryproject.org/
 
 
@@ -23,45 +20,11 @@ The project module :py:mod:`gvamysql`
    :members:
 
 
-:py:mod:`gvamysql.urls`
------------------------
-
-.. automodule:: gvamysql.urls
-
-
-:py:mod:`gvamysql.wsgi`
------------------------
-
-.. automodule:: gvamysql.wsgi
-   :members:
-
-
 :py:mod:`gvamysql.settings`
 ---------------------------
 
 .. automodule:: gvamysql.settings
 
-:py:mod:`gvamysql.settings.base`
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: gvamysql.settings.base
-   :members:
-
-:py:mod:`gvamysql.settings.local`
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: gvamysql.settings.local
-
-:py:mod:`gvamysql.settings.production`
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: gvamysql.settings.production
-
-:py:mod:`gvamysql.settings.test`
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: gvamysql.settings.test
-
 
 :py:mod:`mysqltasks` app
 ========================
diff --git a/docs/conf.py b/docs/conf.py
index 8016554..1538cc2 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -14,18 +14,12 @@
 
 import sys
 import os
-import django
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.insert(0, os.path.abspath(os.path.join('..', 'gvamysql')))
 
-os.environ['GVAMYSQL_ALLOWED_HOSTS'] = 'localhost'
-os.environ['GVAMYSQL_SERVER_EMAIL'] = 'root@localhost'
-
-django.setup()
-
 # -- General configuration -----------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
diff --git a/docs/install.rst b/docs/install.rst
index 0736466..06da90c 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -28,8 +28,7 @@ your virtualenv:
 .. _virtualenv: https://virtualenv.pypa.io/en/latest/
 
 You will also need to ensure that the virtualenv has the project directory
-added to the path. Adding the project directory will allow `django-admin.py` to
-be able to change settings using the `--settings` flag.
+added to the path.
 
 .. index:: virtualenvwrapper
 
diff --git a/gvamysql/gvamysql/celery.py b/gvamysql/gvamysql/celery.py
index 31b104b..8867263 100644
--- a/gvamysql/gvamysql/celery.py
+++ b/gvamysql/gvamysql/celery.py
@@ -6,18 +6,10 @@ This module defines the Celery_ app for gvamysql.
 """
 from __future__ import absolute_import
 
-import os
-
 from celery import Celery
 
-from django.conf import settings
-
-os.environ.setdefault('DJANGO_SETTINGS_MODULE',
-                      'gvamysql.settings.production')
-
-
 #: The Celery application
 app = Celery('gvamysql')
 
-app.config_from_object('django.conf:settings')
-app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
+app.config_from_object('gvamysql.settings')
+app.autodiscover_tasks(['mysqltasks'], force=True)
diff --git a/gvamysql/gvamysql/settings.py b/gvamysql/gvamysql/settings.py
new file mode 100644
index 0000000..f22497b
--- /dev/null
+++ b/gvamysql/gvamysql/settings.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+# pymode:lint_ignore=E501
+"""
+Common settings and globals.
+
+"""
+
+from os import environ
+
+
+def get_env_setting(setting):
+    """
+    Get the environment setting or return exception.
+
+    :param str setting: name of an environment setting
+    :raises ImproperlyConfigured: if the environment setting is not defined
+    :return: environment setting value
+    :rtype: str
+    """
+    try:
+        return environ[setting]
+    except KeyError:
+        error_msg = "Set the %s env variable" % setting
+        raise AssertionError(error_msg)
+
+
+########## CELERY CONFIGURATION
+CELERY_TIMEZONE = 'Europe/Berlin'
+CELERY_ENABLE_UTC = True
+CELERY_RESULT_BACKEND = 'amqp'
+CELERY_RESULT_PERSISTENT = True
+CELERY_TASK_RESULT_EXPIRES = None
+CELERY_ROUTES = (
+    'gvacommon.celeryrouters.Router',
+    'gvacommon.celeryrouters.FileRouter',
+)
+CELERY_ACCEPT_CONTENT = ['json']
+CELERY_TASK_SERIALIZER = 'json'
+CELERY_RESULT_SERIALIZER = 'json'
+BROKER_URL = get_env_setting('GVAMYSQL_BROKER_URL')
+########## END CELERY CONFIGURATION
+
+########## GVAMYSQL CONFIGURATION
+GVAMYSQL_DBADMIN_HOST = get_env_setting('GVAMYSQL_DBADMIN_HOST')
+GVAMYSQL_DBADMIN_PORT = int(get_env_setting('GVAMYSQL_DBADMIN_PORT'))
+GVAMYSQL_DBADMIN_USER = get_env_setting('GVAMYSQL_DBADMIN_USER')
+GVAMYSQL_DBADMIN_PASSWORD = get_env_setting('GVAMYSQL_DBADMIN_PASSWORD')
+########## END GVAMYSQL CONFIGURATION
diff --git a/gvamysql/gvamysql/settings/__init__.py b/gvamysql/gvamysql/settings/__init__.py
deleted file mode 100644
index 4f53a5e..0000000
--- a/gvamysql/gvamysql/settings/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""
-This module contains settings for various environments.
-"""
diff --git a/gvamysql/gvamysql/settings/base.py b/gvamysql/gvamysql/settings/base.py
deleted file mode 100644
index 511fe38..0000000
--- a/gvamysql/gvamysql/settings/base.py
+++ /dev/null
@@ -1,294 +0,0 @@
-# -*- coding: utf-8 -*-
-# pymode:lint_ignore=E501
-"""
-Common settings and globals.
-
-"""
-
-from os.path import abspath, basename, dirname, join, normpath
-from sys import path
-from os import environ
-
-# Normally you should not import ANYTHING from Django directly
-# into your settings, but ImproperlyConfigured is an exception.
-from django.core.exceptions import ImproperlyConfigured
-
-
-def get_env_setting(setting):
-    """
-    Get the environment setting or return exception.
-
-    :param str setting: name of an environment setting
-    :raises ImproperlyConfigured: if the environment setting is not defined
-    :return: environment setting value
-    :rtype: str
-    """
-    try:
-        return environ[setting]
-    except KeyError:
-        error_msg = "Set the %s env variable" % setting
-        raise ImproperlyConfigured(error_msg)
-
-
-########## PATH CONFIGURATION
-# Absolute filesystem path to the Django project directory:
-DJANGO_ROOT = dirname(dirname(abspath(__file__)))
-
-# Absolute filesystem path to the top-level project folder:
-SITE_ROOT = dirname(DJANGO_ROOT)
-
-# Site name:
-SITE_NAME = basename(DJANGO_ROOT)
-
-# Add our project to our pythonpath, this way we don't need to type our project
-# name in our dotted import paths:
-path.append(DJANGO_ROOT)
-########## END PATH CONFIGURATION
-
-
-########## DEBUG CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
-DEBUG = False
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
-TEMPLATE_DEBUG = DEBUG
-########## END DEBUG CONFIGURATION
-
-
-########## MANAGER CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
-ADMINS = (
-    (get_env_setting('GVAMYSQL_ADMIN_NAME'), get_env_setting('GVAMYSQL_ADMIN_EMAIL')),
-)
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
-MANAGERS = ADMINS
-########## END MANAGER CONFIGURATION
-
-
-########## DATABASE CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.sqlite3',
-        'NAME': normpath(join(DJANGO_ROOT, 'default.db')),
-        'USER': '',
-        'PASSWORD': '',
-        'HOST': '',
-        'PORT': '',
-    },
-}
-########## END DATABASE CONFIGURATION
-
-
-########## GENERAL CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
-TIME_ZONE = 'Europe/Berlin'
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
-LANGUAGE_CODE = 'en-us'
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
-SITE_ID = 1
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
-USE_I18N = True
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
-USE_L10N = True
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
-USE_TZ = True
-########## END GENERAL CONFIGURATION
-
-
-########## MEDIA CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
-MEDIA_ROOT = normpath(join(SITE_ROOT, 'media'))
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
-MEDIA_URL = '/media/'
-########## END MEDIA CONFIGURATION
-
-
-########## STATIC FILE CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
-STATIC_ROOT = normpath(join(SITE_ROOT, 'assets'))
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
-STATIC_URL = '/static/'
-
-# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
-STATICFILES_DIRS = (
-    normpath(join(SITE_ROOT, 'static')),
-)
-
-# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
-STATICFILES_FINDERS = (
-    'django.contrib.staticfiles.finders.FileSystemFinder',
-    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-)
-########## END STATIC FILE CONFIGURATION
-
-
-########## SECRET CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
-# Note: This key should only be used for development and testing.
-SECRET_KEY = get_env_setting('GVAMYSQL_SECRETKEY')
-########## END SECRET CONFIGURATION
-
-
-########## SITE CONFIGURATION
-# Hosts/domain names that are valid for this site
-# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
-ALLOWED_HOSTS = []
-########## END SITE CONFIGURATION
-
-
-########## FIXTURE CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
-FIXTURE_DIRS = (
-    normpath(join(SITE_ROOT, 'fixtures')),
-)
-########## END FIXTURE CONFIGURATION
-
-
-########## TEMPLATE CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
-TEMPLATE_CONTEXT_PROCESSORS = (
-    'django.contrib.auth.context_processors.auth',
-    'django.core.context_processors.debug',
-    'django.core.context_processors.i18n',
-    'django.core.context_processors.media',
-    'django.core.context_processors.static',
-    'django.core.context_processors.tz',
-    'django.contrib.messages.context_processors.messages',
-    'django.core.context_processors.request',
-)
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
-TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.Loader',
-    'django.template.loaders.app_directories.Loader',
-)
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
-TEMPLATE_DIRS = (
-    normpath(join(SITE_ROOT, 'templates')),
-)
-########## END TEMPLATE CONFIGURATION
-
-
-########## MIDDLEWARE CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes
-MIDDLEWARE_CLASSES = (
-    # Default Django middleware.
-    'django.middleware.common.CommonMiddleware',
-    'django.contrib.sessions.middleware.SessionMiddleware',
-    'django.middleware.csrf.CsrfViewMiddleware',
-    'django.contrib.auth.middleware.AuthenticationMiddleware',
-    'django.contrib.messages.middleware.MessageMiddleware',
-    'django.middleware.clickjacking.XFrameOptionsMiddleware',
-)
-########## END MIDDLEWARE CONFIGURATION
-
-
-########## URL CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
-ROOT_URLCONF = '%s.urls' % SITE_NAME
-########## END URL CONFIGURATION
-
-
-########## TEST RUNNER CONFIGURATION
-TEST_RUNNER = 'django.test.runner.DiscoverRunner'
-########## END TEST RUNNER CONFIGURATION
-
-
-########## APP CONFIGURATION
-DJANGO_APPS = (
-    # Default Django apps:
-    'django.contrib.auth',
-    'django.contrib.contenttypes',
-    'django.contrib.sessions',
-    'django.contrib.sites',
-    'django.contrib.messages',
-    'django.contrib.staticfiles',
-
-    # Useful template tags:
-    # 'django.contrib.humanize',
-
-    # Admin panel and documentation:
-    'django.contrib.admin',
-    # 'django.contrib.admindocs',
-)
-
-# Apps specific for this project go here.
-LOCAL_APPS = (
-    'mysqltasks',
-)
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
-INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS
-########## END APP CONFIGURATION
-
-
-########## LOGGING CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
-# A sample logging configuration. The only tangible logging
-# performed by this configuration is to send an email to
-# the site admins on every HTTP 500 error when DEBUG=False.
-# See http://docs.djangoproject.com/en/dev/topics/logging for
-# more details on how to customize your logging configuration.
-LOGGING = {
-    'version': 1,
-    'disable_existing_loggers': False,
-    'filters': {
-        'require_debug_false': {
-            '()': 'django.utils.log.RequireDebugFalse'
-        }
-    },
-    'handlers': {
-        'mail_admins': {
-            'level': 'ERROR',
-            'filters': ['require_debug_false'],
-            'class': 'django.utils.log.AdminEmailHandler'
-        }
-    },
-    'loggers': {
-        'django.request': {
-            'handlers': ['mail_admins'],
-            'level': 'ERROR',
-            'propagate': True,
-        },
-    }
-}
-########## END LOGGING CONFIGURATION
-
-
-########## WSGI CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
-WSGI_APPLICATION = '%s.wsgi.application' % SITE_NAME
-########## END WSGI CONFIGURATION
-
-
-########## GVAMYSQL CONFIGURATION
-GVAMYSQL_DBADMIN_USER = get_env_setting('GVAMYSQL_DBADMIN_USER')
-GVAMYSQL_DBADMIN_PASSWORD = get_env_setting('GVAMYSQL_DBADMIN_PASSWORD')
-########## END GVAMYSQL CONFIGURATION
-
-
-########## CELERY CONFIGURATION
-BROKER_URL = get_env_setting('GVAMYSQL_BROKER_URL')
-CELERY_RESULT_BACKEND = 'amqp'
-CELERY_RESULT_PERSISTENT = True
-CELERY_TASK_RESULT_EXPIRES = None
-CELERY_ROUTES = (
-    'gvacommon.celeryrouters.Router',
-    'gvacommon.celeryrouters.FileRouter',
-)
-CELERY_TIMEZONE = 'Europe/Berlin'
-CELERY_ENABLE_UTC = True
-CELERY_ACCEPT_CONTENT = ['json']
-CELERY_TASK_SERIALIZER = 'json'
-CELERY_RESULT_SERIALIZER = 'json'
-########## END CELERY CONFIGURATION
diff --git a/gvamysql/gvamysql/settings/local.py b/gvamysql/gvamysql/settings/local.py
deleted file mode 100644
index dbd4381..0000000
--- a/gvamysql/gvamysql/settings/local.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# pymode:lint_ignore=W0401,E501
-"""
-Development settings and globals based on :py:mod:`gvafile.settings.base`.
-
-"""
-
-from __future__ import absolute_import
-
-from .base import *
-
-
-########## DEBUG CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
-DEBUG = True
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
-TEMPLATE_DEBUG = DEBUG
-########## END DEBUG CONFIGURATION
-
-
-########## EMAIL CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
-EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
-########## END EMAIL CONFIGURATION
-
-
-########## CACHE CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
-CACHES = {
-    'default': {
-        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
-    }
-}
-########## END CACHE CONFIGURATION
-
-
-########## TOOLBAR CONFIGURATION
-# See: http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#explicit-setup
-INSTALLED_APPS += (
-    'debug_toolbar',
-)
-
-MIDDLEWARE_CLASSES += (
-    'debug_toolbar.middleware.DebugToolbarMiddleware',
-)
-
-DEBUG_TOOLBAR_PATCH_SETTINGS = False
-
-# http://django-debug-toolbar.readthedocs.org/en/latest/installation.html
-INTERNAL_IPS = ('127.0.0.1',)
-########## END TOOLBAR CONFIGURATION
diff --git a/gvamysql/gvamysql/settings/production.py b/gvamysql/gvamysql/settings/production.py
deleted file mode 100644
index 2ae7f46..0000000
--- a/gvamysql/gvamysql/settings/production.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# pymode:lint_ignore=W0401,E501
-"""
-Production settings and globals based on :py:mod:`gvafile.settings.base`.
-
-"""
-
-from __future__ import absolute_import
-
-from .base import *
-
-########## HOST CONFIGURATION
-# See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production
-ALLOWED_HOSTS = get_env_setting('GVAMYSQL_ALLOWED_HOSTS').split(',')
-########## END HOST CONFIGURATION
-
-########## EMAIL CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
-EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host
-#EMAIL_HOST = environ.get('EMAIL_HOST', 'smtp.gmail.com')
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
-#EMAIL_HOST_PASSWORD = environ.get('EMAIL_HOST_PASSWORD', '')
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
-#EMAIL_HOST_USER = environ.get('EMAIL_HOST_USER', 'your_email@example.com')
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-port
-#EMAIL_PORT = environ.get('EMAIL_PORT', 587)
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
-EMAIL_SUBJECT_PREFIX = '[%s] ' % SITE_NAME
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-use-tls
-#EMAIL_USE_TLS = True
-
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email
-SERVER_EMAIL = get_env_setting('GVAMYSQL_SERVER_EMAIL')
-########## END EMAIL CONFIGURATION
-
-########## DATABASE CONFIGURATION
-#DATABASES = {}
-########## END DATABASE CONFIGURATION
-
-
-########## CACHE CONFIGURATION
-# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
-#CACHES = {}
-########## END CACHE CONFIGURATION
diff --git a/gvamysql/gvamysql/settings/test.py b/gvamysql/gvamysql/settings/test.py
deleted file mode 100644
index a132e85..0000000
--- a/gvamysql/gvamysql/settings/test.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# pymode:lint_ignore=W0401
-"""
-Test settings based on :py:mod:`gvafile.settings.base`.
-
-"""
-from __future__ import absolute_import
-
-from .base import *
-
-########## IN-MEMORY TEST DATABASE
-DATABASES = {
-    "default": {
-        "ENGINE": "django.db.backends.sqlite3",
-        "NAME": ":memory:",
-        "USER": "",
-        "PASSWORD": "",
-        "HOST": "",
-        "PORT": "",
-    },
-}
diff --git a/gvamysql/gvamysql/urls.py b/gvamysql/gvamysql/urls.py
deleted file mode 100644
index 450b2f9..0000000
--- a/gvamysql/gvamysql/urls.py
+++ /dev/null
@@ -1,25 +0,0 @@
-"""
-This module defines the main URLConf for gvamysql.
-
-"""
-
-from django.conf.urls import patterns, include, url
-from django.conf import settings
-
-# Uncomment the next two lines to enable the admin:
-from django.contrib import admin
-admin.autodiscover()
-
-urlpatterns = patterns(
-    '',
-    url(r'^admin/', include(admin.site.urls)),
-)
-
-# Uncomment the next line to serve media files in dev.
-# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
-
-if settings.DEBUG:
-    import debug_toolbar
-    urlpatterns += patterns('',
-                            url(r'^__debug__/', include(debug_toolbar.urls)),
-                            )
diff --git a/gvamysql/manage.py b/gvamysql/manage.py
deleted file mode 100755
index 3970649..0000000
--- a/gvamysql/manage.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-import os
-import sys
-
-if __name__ == "__main__":
-    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gvafile.settings")
-
-    from django.core.management import execute_from_command_line
-
-    execute_from_command_line(sys.argv)
diff --git a/gvamysql/mysqltasks/models.py b/gvamysql/mysqltasks/models.py
deleted file mode 100644
index d1ff455..0000000
--- a/gvamysql/mysqltasks/models.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""
-Empty models module required for Django to accept this as an app.
-"""
diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index 81d28fa..39ccf53 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -4,8 +4,6 @@ This module defines Celery_ tasks to manage MySQL users and database.
 """
 from __future__ import absolute_import, unicode_literals
 
-from django.conf import settings
-
 from celery import shared_task
 from celery.utils.log import get_task_logger
 

From 1b8c4ce69723394344b742b7de357badb21e1c6e Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 22:17:41 +0100
Subject: [PATCH 04/13] add task implementations

---
 gvamysql/mysqltasks/tasks.py | 68 ++++++++++++++++++++++++++++++++++--
 1 file changed, 66 insertions(+), 2 deletions(-)

diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index 39ccf53..1a3ca11 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -7,10 +7,21 @@ from __future__ import absolute_import, unicode_literals
 from celery import shared_task
 from celery.utils.log import get_task_logger
 
+from gvamysql import settings
+from MySQLdb import connect
+
 
 _LOGGER = get_task_logger(__name__)
 
 
+def _get_connection():
+    return connect(
+        host=settings.GVAMYSQL_DBADMIN_HOST,
+        port=settings.GVAMYSQL_DBADMIN_PORT,
+        user=settings.GVAMYSQL_DBADMIN_USER,
+        password=settings.GVAMYSQL_DBADMIN_PASSWORD)
+
+
 @shared_task
 def create_mysql_user(username, password):
     """
@@ -22,6 +33,16 @@ def create_mysql_user(username, password):
     :rtype: str
 
     """
+    conn = _get_connection()
+    curs = conn.cursor()
+    curs.execute(
+        """
+        CREATE USER %(username)s@'%' IDENTIFIED BY %(password)s
+        """,
+        {'username': username, 'password': password}
+    )
+    conn.commit()
+    return username
 
 
 @shared_task
@@ -35,6 +56,15 @@ def set_mysql_userpassword(username, password):
     :rtype: boolean
 
     """
+    conn = _get_connection()
+    curs = conn.cursor()
+    curs.execute(
+        """
+        SET PASSWORD FOR %(username)s = PASSWORD(%(password)s)
+        """,
+        {'username': username, 'password': password})
+    conn.commit()
+    return True
 
 
 @shared_task
@@ -47,6 +77,15 @@ def delete_mysql_user(username):
     :rtype: boolean
 
     """
+    conn = _get_connection()
+    curs = conn.cursor()
+    curs.execute(
+        """
+        DROP USER %(username)s@'%'
+        """,
+        {'username': username})
+    conn.commit()
+    return True
 
 
 @shared_task
@@ -60,15 +99,40 @@ def create_mysql_database(dbname, username):
     :rtype: str
 
     """
+    conn = _get_connection()
+    curs = conn.cursor()
+    curs.execute(
+        """
+        CREATE DATABASE %(dbname)s CHARACTER SET utf8 COLLATE utf8_german_ci
+        """,
+        {'dbname': dbname})
+    curs.execute(
+        """
+        GRANT ALL PRIVILEGES ON %(dbname)s.* TO %(username)s@'%'
+        """,
+        {'dbname': dbname, 'username': username})
+    conn.commit()
+    return dbname
 
 
 @shared_task
-def delete_mysql_database(dbname):
+def delete_mysql_database(dbname, username):
     """
-    This task deletes an existing MySQL database.
+    This task deletes an existing MySQL database and revokes privileges of the
+    given user on that database.
 
     :param str dbname: database name
+    :param str username: the user name of an existing MySQL user
     :return: True if the database has been deleted, False otherwise
     :rtype: boolean
 
     """
+    conn = _get_connection()
+    curs = conn.cursor()
+    curs.execute(
+        """
+        REVOKE ALL PRIVILEGES ON %(dbname)s.* FROM %(username)s@'%'
+        """,
+        {'dbname': dbname, 'username': username})
+    conn.commit()
+    return True

From 546441d49920caf43eb7d33976c2d71ae85f16d5 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 22:32:37 +0100
Subject: [PATCH 05/13] unify routers, add support for mysql and pgsql tasks

- add new celeryrouters.GvaRouter
- remove LdapRouter and FileRouter
---
 .gitignore       |  1 +
 celeryrouters.py | 23 +++++++----------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3bb2efd..5f1ace6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 .*.swp
 *.pyc
+.ropeproject/
diff --git a/celeryrouters.py b/celeryrouters.py
index e468813..ec7b122 100644
--- a/celeryrouters.py
+++ b/celeryrouters.py
@@ -2,23 +2,14 @@
 from __future__ import unicode_literals
 
 
-class LdapRouter(object):
+class GvaRouter(object):
 
     def route_for_task(self, task, args=None, kwargs=None):
-        if 'ldap' in task:
-            return {'exchange': 'ldap',
+        for route in ['ldap', 'file', 'mysql', 'pgsql']:
+            if route in task:
+                return {
+                    'exchange': route,
                     'exchange_type': 'direct',
-                    'queue': 'ldap'}
+                    'queue': route,
+                }
         return None
-
-
-class FileRouter(object):
-
-    def route_for_task(self, task, args=None, kwargs=None):
-        if 'file' in task:
-            return {'exchange': 'file',
-                    'exchange_type': 'direct',
-                    'queue': 'file'}
-        return None
-
-

From a3e766045ec95d7d14889009673e57716483425b Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 22:39:56 +0100
Subject: [PATCH 06/13] switch to gvacommon.celeryrouters.GvaRouter

---
 gvamysql/gvamysql/settings.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gvamysql/gvamysql/settings.py b/gvamysql/gvamysql/settings.py
index f22497b..8063997 100644
--- a/gvamysql/gvamysql/settings.py
+++ b/gvamysql/gvamysql/settings.py
@@ -31,8 +31,7 @@ CELERY_RESULT_BACKEND = 'amqp'
 CELERY_RESULT_PERSISTENT = True
 CELERY_TASK_RESULT_EXPIRES = None
 CELERY_ROUTES = (
-    'gvacommon.celeryrouters.Router',
-    'gvacommon.celeryrouters.FileRouter',
+    'gvacommon.celeryrouters.GvaRouter',
 )
 CELERY_ACCEPT_CONTENT = ['json']
 CELERY_TASK_SERIALIZER = 'json'

From ff83795916981f6f73fec447258b7c0ffd368ce9 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 22:52:21 +0100
Subject: [PATCH 07/13] fix MySQL connection parameters

---
 gvamysql/mysqltasks/tasks.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index 1a3ca11..4e08865 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -19,7 +19,9 @@ def _get_connection():
         host=settings.GVAMYSQL_DBADMIN_HOST,
         port=settings.GVAMYSQL_DBADMIN_PORT,
         user=settings.GVAMYSQL_DBADMIN_USER,
-        password=settings.GVAMYSQL_DBADMIN_PASSWORD)
+        passwd=settings.GVAMYSQL_DBADMIN_PASSWORD,
+        db='mysql',
+    )
 
 
 @shared_task

From 4ed81c29e6d30c27a546a6d71f9e850af3087e3c Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 22:54:57 +0100
Subject: [PATCH 08/13] fix format strings

---
 gvamysql/mysqltasks/tasks.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index 4e08865..3514f52 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -39,7 +39,7 @@ def create_mysql_user(username, password):
     curs = conn.cursor()
     curs.execute(
         """
-        CREATE USER %(username)s@'%' IDENTIFIED BY %(password)s
+        CREATE USER %(username)s@'%%' IDENTIFIED BY %(password)s
         """,
         {'username': username, 'password': password}
     )
@@ -83,7 +83,7 @@ def delete_mysql_user(username):
     curs = conn.cursor()
     curs.execute(
         """
-        DROP USER %(username)s@'%'
+        DROP USER %(username)s@'%%'
         """,
         {'username': username})
     conn.commit()
@@ -110,7 +110,7 @@ def create_mysql_database(dbname, username):
         {'dbname': dbname})
     curs.execute(
         """
-        GRANT ALL PRIVILEGES ON %(dbname)s.* TO %(username)s@'%'
+        GRANT ALL PRIVILEGES ON %(dbname)s.* TO %(username)s@'%%'
         """,
         {'dbname': dbname, 'username': username})
     conn.commit()
@@ -133,7 +133,7 @@ def delete_mysql_database(dbname, username):
     curs = conn.cursor()
     curs.execute(
         """
-        REVOKE ALL PRIVILEGES ON %(dbname)s.* FROM %(username)s@'%'
+        REVOKE ALL PRIVILEGES ON %(dbname)s.* FROM %(username)s@'%%'
         """,
         {'dbname': dbname, 'username': username})
     conn.commit()

From 2a638481d1c17d1c0de370ec7e059e6df82489ef Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 23:14:37 +0100
Subject: [PATCH 09/13] fix broken MySQL quoting

---
 gvamysql/mysqltasks/tasks.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index 3514f52..7b39a2b 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -105,14 +105,12 @@ def create_mysql_database(dbname, username):
     curs = conn.cursor()
     curs.execute(
         """
-        CREATE DATABASE %(dbname)s CHARACTER SET utf8 COLLATE utf8_german_ci
-        """,
-        {'dbname': dbname})
+        CREATE DATABASE `%(dbname)s` CHARACTER SET utf8 COLLATE utf8_german_ci
+        """ % {'dbname': dbname})
     curs.execute(
         """
-        GRANT ALL PRIVILEGES ON %(dbname)s.* TO %(username)s@'%%'
-        """,
-        {'dbname': dbname, 'username': username})
+        GRANT ALL PRIVILEGES ON `%(dbname)s`.* TO %%(username)s@'%%%%'
+        """ % {'dbname': dbname}, {'username': username})
     conn.commit()
     return dbname
 
@@ -133,8 +131,7 @@ def delete_mysql_database(dbname, username):
     curs = conn.cursor()
     curs.execute(
         """
-        REVOKE ALL PRIVILEGES ON %(dbname)s.* FROM %(username)s@'%%'
-        """,
-        {'dbname': dbname, 'username': username})
+        REVOKE ALL PRIVILEGES ON `%(dbname)s`.* FROM %%(username)s@'%%%%'
+        """ % {'dbname': dbname}, {'username': username})
     conn.commit()
     return True

From 2b4c9ba33d41464d8d76cd0d913e7ec93a875901 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 1 Jan 2015 23:19:20 +0100
Subject: [PATCH 10/13] fix collation name

---
 gvamysql/mysqltasks/tasks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index 7b39a2b..ff108ca 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -105,7 +105,7 @@ def create_mysql_database(dbname, username):
     curs = conn.cursor()
     curs.execute(
         """
-        CREATE DATABASE `%(dbname)s` CHARACTER SET utf8 COLLATE utf8_german_ci
+        CREATE DATABASE `%(dbname)s` CHARACTER SET utf8 COLLATE utf8_general_ci
         """ % {'dbname': dbname})
     curs.execute(
         """

From 7fe405a27d1d6a07c4440910d4df212c4be85940 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Fri, 2 Jan 2015 00:06:31 +0100
Subject: [PATCH 11/13] actually drop database in delete_mysql_database

---
 gvamysql/mysqltasks/tasks.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index ff108ca..6320a8e 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -133,5 +133,9 @@ def delete_mysql_database(dbname, username):
         """
         REVOKE ALL PRIVILEGES ON `%(dbname)s`.* FROM %%(username)s@'%%%%'
         """ % {'dbname': dbname}, {'username': username})
+    curs.execute(
+        """
+        DROP DATABASE `%(dbname)s`
+        """ % {'dbname': dbname})
     conn.commit()
     return True

From 919be9e15f310eaad74bdf9b19fe369fd328e480 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Sun, 4 Jan 2015 22:48:42 +0100
Subject: [PATCH 12/13] fix grammar in docstring

---
 gvamysql/mysqltasks/tasks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gvamysql/mysqltasks/tasks.py b/gvamysql/mysqltasks/tasks.py
index 6320a8e..e40522b 100644
--- a/gvamysql/mysqltasks/tasks.py
+++ b/gvamysql/mysqltasks/tasks.py
@@ -1,5 +1,5 @@
 """
-This module defines Celery_ tasks to manage MySQL users and database.
+This module defines Celery_ tasks to manage MySQL users and databases.
 
 """
 from __future__ import absolute_import, unicode_literals

From eac916f28b6449e69a487ec7d1ab9ca5224a9eea Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Sun, 4 Jan 2015 22:53:19 +0100
Subject: [PATCH 13/13] define release version, update copyright years

---
 LICENSE.txt        | 2 +-
 docs/changelog.rst | 3 ++-
 docs/conf.py       | 6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/LICENSE.txt b/LICENSE.txt
index 8c51745..96e8baa 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2014 Jan Dittberner
+Copyright (c) 2014, 2015 Jan Dittberner
 
 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation
diff --git a/docs/changelog.rst b/docs/changelog.rst
index eb784c5..05cebe2 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,4 +1,5 @@
 Changelog
 =========
 
-* feature:`-` initial project setup
+* :release:`0.1.0 <2015-01-04>`
+* :feature:`-` initial project setup
diff --git a/docs/conf.py b/docs/conf.py
index 1538cc2..ee8ec46 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -47,16 +47,16 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'gvamysql'
-copyright = u'2014, Jan Dittberner'
+copyright = u'2014, 2015 Jan Dittberner'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = '0.2.0'
+version = '0.1'
 # The full version, including alpha/beta/rc tags.
-release = '0.2.0'
+release = '0.1.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.