Browse Source

Update README.md

Nick Sweeting 1 year ago
parent
commit
52faf81096
1 changed files with 32 additions and 4 deletions
  1. 32 4
      README.md

+ 32 - 4
README.md

@@ -1441,16 +1441,16 @@ archivebox init --setup
 </details>
 </details>
 
 
 
 
-#### Make DB migrations, enter Django shell, or view ORM models graph
+#### Make DB migrations, enter Django shell, other dev helper commands
 
 
 <details><summary><i>Click to expand...</i></summary>
 <details><summary><i>Click to expand...</i></summary>
 
 
-Make sure to run this whenever you change things in `models.py`.
-
 ```bash
 ```bash
+# generate the database migrations after changes to models.py
 cd archivebox/
 cd archivebox/
 ./manage.py makemigrations
 ./manage.py makemigrations
 
 
+# enter a python shell or a SQL shell
 cd path/to/test/data/
 cd path/to/test/data/
 archivebox shell
 archivebox shell
 archivebox manage dbshell
 archivebox manage dbshell
@@ -1460,11 +1460,39 @@ brew install graphviz
 pip install pydot graphviz
 pip install pydot graphviz
 archivebox manage graph_models -a -o orm.png
 archivebox manage graph_models -a -o orm.png
 open orm.png
 open orm.png
+
+# list all models with field db info and methods
+archivebox manage list_model_info --all --signature --db-type --field-class
+
+# print all django settings
+archivebox manage print_settings
+archivebox manage print_settings --format=yaml    # pip install pyyaml
+
+# autogenerate an admin.py from given app models
+archivebox manage admin_generator core > core/admin.py
+
+# dump db data to a script that re-populates it
+archivebox manage dumpscript core > scripts/testdata.py
+archivebox manage reset core
+archivebox manage runscript testdata
+
+# resetdb and clear all data!
+archivebox manage reset_db
+
+# use django-tui to interactively explore commands
+pip install django-tui
+# ensure django-tui is in INSTALLED_APPS: core/settings.py
+archivebox manage tui
 ```
 ```
 
 
 <img src="https://github.com/ArchiveBox/ArchiveBox/assets/511499/dc3e9f8c-9544-46e0-a7f0-30f571b72022" width="600px" alt="ArchiveBox ORM models relatinoship graph"/>
 <img src="https://github.com/ArchiveBox/ArchiveBox/assets/511499/dc3e9f8c-9544-46e0-a7f0-30f571b72022" width="600px" alt="ArchiveBox ORM models relatinoship graph"/>
 
 
-https://stackoverflow.com/questions/1074212/how-can-i-see-the-raw-sql-queries-django-is-running
+- https://django-extensions.readthedocs.io/en/latest/command_extensions.html
+- https://stackoverflow.com/questions/1074212/how-can-i-see-the-raw-sql-queries-django-is-running
+- https://github.com/anze3db/django-tui (explore `manage.py` commands as TUI)
+- https://github.com/bloomberg/memray (advanced python profiler)
+- https://github.com/laixintao/flameshow (display flamegraphs in terminal)
+- https://github.com/taliraj/django-migrations-tui (explore migrations as TUI)
 
 
 </details>
 </details>