Add example app.
This commit is contained in:
parent
4e53ee7fa9
commit
45c5fe7a86
1
example_app/.gitignore
vendored
Normal file
1
example_app/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.sqlite3
|
23
example_app/README.md
Normal file
23
example_app/README.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Example Django App
|
||||||
|
|
||||||
|
This is just a simple Django app with all the necessary things to work with `django-oidc-provider` package.
|
||||||
|
|
||||||
|
## Setup & Running
|
||||||
|
|
||||||
|
Setup project environment with [virtualenv](https://virtualenv.pypa.io) and [pip](https://pip.pypa.io).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ virtualenv project_env
|
||||||
|
$ source project_env/bin/activate
|
||||||
|
$ git clone https://github.com/juanifioren/django-oidc-provider.git
|
||||||
|
$ cd django-oidc-provider/example_app
|
||||||
|
$ pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Run your provider.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ python manage.py makemigrations
|
||||||
|
$ python manage.py migrate
|
||||||
|
$ python manage.py runserver
|
||||||
|
```
|
10
example_app/manage.py
Executable file
10
example_app/manage.py
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "provider_app.settings")
|
||||||
|
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
|
execute_from_command_line(sys.argv)
|
0
example_app/provider_app/__init__.py
Normal file
0
example_app/provider_app/__init__.py
Normal file
76
example_app/provider_app/settings.py
Normal file
76
example_app/provider_app/settings.py
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
|
import os
|
||||||
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'waw%j=vza!vc1^eyosw%#_!gg96%zb7sp*+!owkutue4i(sm91'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
TEMPLATE_DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = (
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
|
'oidc_provider',
|
||||||
|
)
|
||||||
|
|
||||||
|
MIDDLEWARE_CLASSES = (
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
)
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'provider_app.urls'
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'provider_app.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_L10N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
|
||||||
|
# OIDC Provider settings.
|
||||||
|
|
||||||
|
SITE_URL = 'http://localhost:8000'
|
8
example_app/provider_app/urls.py
Normal file
8
example_app/provider_app/urls.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from django.conf.urls import patterns, include, url
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
urlpatterns = patterns('',
|
||||||
|
url(r'^openid/', include('oidc_provider.urls', namespace='oidc_provider')),
|
||||||
|
|
||||||
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
|
)
|
5
example_app/provider_app/wsgi.py
Normal file
5
example_app/provider_app/wsgi.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import os
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "provider_app.settings")
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
application = get_wsgi_application()
|
2
example_app/requirements.txt
Normal file
2
example_app/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
django==1.7.7
|
||||||
|
django-oidc-provider==0.0.1
|
Loading…
Reference in a new issue