Skip to content

Instantly share code, notes, and snippets.

@spookylukey
Created November 6, 2012 11:19
Show Gist options
  • Save spookylukey/4024116 to your computer and use it in GitHub Desktop.
Save spookylukey/4024116 to your computer and use it in GitHub Desktop.
Automatically use mysqld-ram server if available.
import sys
if sys.argv[1] == "test":
import psutil
def mysqld_ram_running():
return any('mysqld-ram.sh' in ' '.join(p.cmdline) for p in psutil.get_process_list())
if mysqld_ram_running():
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'djangotests',
'USER': 'tester',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'PORT': '3307',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment