From ce6b57bf9d94db149777488028ec191af46a472b Mon Sep 17 00:00:00 2001 From: Brian Wiborg Date: Sat, 27 Sep 2025 15:40:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20More=20info=20on=20shell=20comma?= =?UTF-8?q?nd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4b80057..eb2d01a 100644 --- a/README.md +++ b/README.md @@ -183,14 +183,6 @@ Run your project: ohmyapi serve ``` -## Shell - -Similar to Django, you can attach to an interactive shell with your project already loaded inside. - -``` -ohmyapi shell -``` - ## Authentication A builtin auth app is available. @@ -281,3 +273,40 @@ class Team(Model): class Meta: manager = TeamManager() ``` + +## Shell + +Similar to Django, you can attach to an interactive shell with your project already loaded inside. + +``` +ohmyapi shell + +Python 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813] +Type 'copyright', 'credits' or 'license' for more information +IPython 9.5.0 -- An enhanced Interactive Python. Type '?' for help. + +OhMyAPI Shell | Project: {{ project_name }} [{{ project_path }}] +Find your loaded project singleton via identifier: `p` +``` + +```python +In [1]: p +Out[1]: + +In [2]: p.apps +Out[2]: +{'ohmyapi_auth': App: ohmyapi_auth + Models: + - Group + - User + Routes: + - APIRoute(path='/auth/login', name='login', methods=['POST']) + - APIRoute(path='/auth/refresh', name='refresh_token', methods=['POST']) + - APIRoute(path='/auth/me', name='me', methods=['GET']) + - APIRoute(path='/auth/introspect', name='introspect', methods=['GET'])} + +In [3]: from tournament.models import Tournament +Out[3]: + +``` +