Created
November 6, 2012 11:19
-
-
Save spookylukey/4024116 to your computer and use it in GitHub Desktop.
Automatically use mysqld-ram server if available.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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