Skip to content

Commit f2815c2

Browse files
committed
Make it simpler to run the example project
Now, can run the example project with a single command: make example The make target now migrates the database and creates a superuser. This removes some manual steps when doing simple manual testing of Django Debug Toolbar.
1 parent 7ecd3c1 commit f2815c2

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ flake8:
1313
flake8
1414

1515
example:
16+
python example/manage.py migrate --noinput
17+
-DJANGO_SUPERUSER_PASSWORD=p python example/manage.py createsuperuser \
18+
--noinput --username="$(USER)" --email="$(USER)@mailinator.com"
1619
python example/manage.py runserver
1720

1821
eslint: package-lock.json

example/README.rst

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,36 @@ interfere with common JavaScript frameworks.
1313
How to
1414
------
1515

16-
The test project requires a working installation of Django::
16+
The example project requires a working installation of Django::
1717

1818
$ pip install Django
1919

20-
The following commands must be run from the root directory of a checkout of
21-
the debug toolbar, ie. the directory that contains ``example/``.
20+
The following command must run from the root directory of Django Debug Toolbar,
21+
i.e. the directory that contains ``example/``::
2222

23-
Before running the example for the first time, you must create a database::
23+
$ make example
2424

25-
$ python -m django migrate --settings=example.settings
25+
This will create a database, superuser, and run the Django development server.
26+
The superuser's username will be the same as the current OS user and the
27+
password is "p".
2628

27-
Then you can use the following command to run the example::
29+
If you'd like to run these steps individually, use the following commands.
30+
Again, run from the root directory of Django Debug Toolbar.
2831

29-
$ python -m django runserver --settings=example.settings
32+
Create a database::
33+
34+
$ python example/manage.py migrate
35+
36+
Create a superuser::
37+
38+
$ python example/manage.py createsuperuser
39+
40+
Run the Django development server::
41+
42+
$ python example/manage.py runserver
3043

3144
You can change the database used by specifying the ``DJANGO_DATABASE_ENGINE``
3245
environment variable::
3346

34-
$ DJANGO_DATABASE_ENGINE=postgresql python -m django migrate --settings=example.settings
35-
$ DJANGO_DATABASE_ENGINE=postgresql python -m django runserver --settings=example.settings
36-
47+
$ DJANGO_DATABASE_ENGINE=postgresql python example/manage.py migrate
48+
$ DJANGO_DATABASE_ENGINE=postgresql python example/manage.py runserver

0 commit comments

Comments
 (0)