diff --git a/README.md b/README.md index ce24aea6..014ae0be 100644 --- a/README.md +++ b/README.md @@ -1441,16 +1441,16 @@ archivebox init --setup -#### Make DB migrations, enter Django shell, or view ORM models graph +#### Make DB migrations, enter Django shell, other dev helper commands
Click to expand... -Make sure to run this whenever you change things in `models.py`. - ```bash +# generate the database migrations after changes to models.py cd archivebox/ ./manage.py makemigrations +# enter a python shell or a SQL shell cd path/to/test/data/ archivebox shell archivebox manage dbshell @@ -1460,11 +1460,39 @@ brew install graphviz pip install pydot graphviz archivebox manage graph_models -a -o 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 ``` 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)