File tree 3 files changed +35
-1
lines changed
3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,4 @@ yarn-debug.log*
21
21
yarn-error.log *
22
22
.docker-build
23
23
.python_history
24
+ hack.py
Original file line number Diff line number Diff line change @@ -304,7 +304,7 @@ run the gunicorn workers:
304
304
305
305
.. code-block :: shell
306
306
307
- $ DJANGO_CONFIGURATION=Prodlike docker-compose run --service-ports web web
307
+ $ docker-compose run --service-ports --user 0 web bash
308
308
309
309
This will start 4 ``gunicorn `` workers exposed on ``0.0.0.0:8000 `` and
310
310
exposed outside of docker onto your host.
@@ -363,3 +363,20 @@ and then run it with extra ``pytest`` parameters. For example:
363
363
.. code-block :: shell
364
364
365
365
$ docker-compose run systemtest tests/systemtest/run_tests.sh -k test_delberately_404ing_and_csv_reporting
366
+
367
+ Shells and ``hack.py ``
368
+ ======================
369
+
370
+ There are a couple of good ways to get into the Python environment and
371
+ be able to "hack around" and try stuff. For example, you might want to just
372
+ poke around in the ORM, or test various performance tricks and as it
373
+ gets more complicated it gets messy in a shell. Especially if you want to
374
+ re-run something on multiple lines repeatedly.
375
+
376
+ Instead, copy the file ``hack.py-dist `` to ``hack.py `` and start editing it.
377
+ Then, to run it, start a shell and execute it:
378
+
379
+ .. code-block :: shell
380
+
381
+ $ make shell
382
+ # python hack.py
Original file line number Diff line number Diff line change
1
+ """
2
+ Development hack tool. This file is meant for developers trying stuff.
3
+ Oftentimes, it's enough to start a Python shell, or the Django shell
4
+ but that can get cumbersome and it's obviously not editable in your
5
+ editor. That's that this file is for.
6
+ """
7
+
8
+ import os
9
+ from django.core.wsgi import get_wsgi_application
10
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tecken.settings')
11
+ application = get_wsgi_application() # for django-configurations
12
+ # End of boilerplate stuff
13
+
14
+
15
+ # from django.conf import settings
16
+ from tecken.something import something
You can’t perform that action at this time.
0 commit comments