Skip to content

Commit 8c24ac9

Browse files
committed
Include configurations for PostgreSQL and MySQL.
1 parent 8a9348a commit 8c24ac9

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

docs/contributing.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ the libraries required for working on the Debug Toolbar::
2424

2525
You can run now run the example application::
2626

27+
$ DJANGO_SETTINGS_MODULE=example.settings django-admin.py syncdb
28+
$ DJANGO_SETTINGS_MODULE=example.settings django-admin.py runserver
29+
30+
For convenience, there's an alias for the second command::
31+
2732
$ make example
2833

34+
Look at ``example/settings.py`` for running the example with another database
35+
than SQLite.
36+
2937
Tests
3038
-----
3139

example/settings.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,30 @@
4949
}
5050
}
5151

52+
# To use another database, set the DJANGO_DATABASE_ENGINE environment variable.
53+
if os.environ.get('DJANGO_DATABASE_ENGINE', '').lower() == 'postgresql':
54+
# % su postgres
55+
# % createuser debug_toolbar
56+
# % createdb debug_toolbar -O debug_toolbar
57+
DATABASES = {
58+
'default': {
59+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
60+
'NAME': 'debug_toolbar',
61+
'USER': 'debug_toolbar',
62+
}
63+
}
64+
if os.environ.get('DJANGO_DATABASE_ENGINE', '').lower() == 'mysql':
65+
# % mysql
66+
# mysql> CREATE DATABASE debug_toolbar;
67+
# mysql> GRANT ALL PRIVILEGES ON debug_toolbar.* TO 'debug_toolbar'@'localhost';
68+
DATABASES = {
69+
'default': {
70+
'ENGINE': 'django.db.backends.mysql',
71+
'NAME': 'debug_toolbar',
72+
'USER': 'debug_toolbar',
73+
}
74+
}
75+
5276

5377
# django-debug-toolbar
5478

0 commit comments

Comments
 (0)