Skip to content
Django REST api quickstart project
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
api Initial commit with project files Dec 3, 2017
djangorestapi Initial commit with project files Dec 3, 2017
.gitignore
Dockerfile Initial commit with project files Dec 3, 2017
LICENSE Initial commit Dec 3, 2017
Pipfile Initial commit with project files Dec 3, 2017
Pipfile.lock Initial commit with project files Dec 3, 2017
README.md Update project description Dec 3, 2017
docker-compose.yaml Initial commit with project files Dec 3, 2017
manage.py Initial commit with project files Dec 3, 2017

README.md

django-rest-quickstart

A Django REST quickstart project with a simple RBAC / ACL example.

Requirements

  • docker >= 17.11

Set up

$ docker-compose run web python manage.py migrate

If you receive an error like "could not connect to server: Connection refused", re-run the command.

Create some users

$ docker-compose run web python manage.py shell

from django.contrib.auth.models import User
u1 = User.objects.create_user(username='user1', password='hello', is_staff=True, first_name='foo', last_name='bar')
u2 = User.objects.create_user(username='user2', password='world', is_staff=True, first_name='baz', last_name='xyz')

Run

$ docker-compose up

Test

curl -H "Authorization: Basic dXNlcjE6aGVsbG8=" http://0.0.0.0:8000/api/profiles/ -v

("dXNlcjE6aGVsbG8="" is "user1:hello" base64-encoded)

You should only be able to see 1 user profile - the one belonging to 'user1'.

You can’t perform that action at this time.