📝 More info on shell command

This commit is contained in:
Brian Wiborg 2025-09-27 15:40:53 +02:00
parent aea68b8128
commit ce6b57bf9d
No known key found for this signature in database

View file

@ -183,14 +183,6 @@ Run your project:
ohmyapi serve ohmyapi serve
``` ```
## Shell
Similar to Django, you can attach to an interactive shell with your project already loaded inside.
```
ohmyapi shell
```
## Authentication ## Authentication
A builtin auth app is available. A builtin auth app is available.
@ -281,3 +273,40 @@ class Team(Model):
class Meta: class Meta:
manager = TeamManager() 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]: <ohmyapi.core.runtime.Project at 0xdeadbeefc0febabe>
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]:
```