| 1 |
--- |
| 2 |
title: Examples |
| 3 |
description: Examples on how to use django-guardian to manage object permissions. |
| 4 |
--- |
| 5 |
|
| 6 |
# Example Projects |
| 7 |
|
| 8 |
Example project should be bundled with archive and be available at |
| 9 |
`example_project`. Before you can run it, some requirements have to be |
| 10 |
met. Those are easily installed using following command at example |
| 11 |
project's directory: |
| 12 |
|
| 13 |
```shell |
| 14 |
$ cd example_project |
| 15 |
$ pip install -r requirements.txt |
| 16 |
``` |
| 17 |
|
| 18 |
`django-guardian` from a directory above the `example_project` is |
| 19 |
automatically added to Python path at runtime. |
| 20 |
|
| 21 |
And the last thing before we can run example project is to create sqlite database: |
| 22 |
|
| 23 |
```shell |
| 24 |
$ ./manage.py migrate |
| 25 |
``` |
| 26 |
|
| 27 |
Finally we can run dev server: |
| 28 |
|
| 29 |
```shell |
| 30 |
$ ./manage.py runserver |
| 31 |
``` |
| 32 |
|
| 33 |
You should also create a user who can login to the admin site: |
| 34 |
|
| 35 |
```shell |
| 36 |
$ ./manage.py createsuperuser |
| 37 |
``` |
| 38 |
|
| 39 |
Project is really basic and shows almost nothing but eventually it |
| 40 |
should expose some `django-guardian` functionality. |
| 41 |
|
| 42 |
To try out |
| 43 |
[django-grappelli](https://django-grappelli.readthedocs.io/en/latest/) |
| 44 |
integration, set the `GRAPPELLI` environment variable before launching `runserver`. |