Probably (just a guess) you haven't defined Django url configuration. Below is simple step-by-step guide. It is not intended for production deployment, but hopefully should give you something functional to play with.
8<------------------------------------------------------------------------------
Create new django project (assuming Django-1.2.x is already installed):
$ django-admin.py startproject django_pki_testsite
Grab the latest source code:
$ git clone git://github.com/dkerwin/django-pki.git
For testing purposes just copy django-pki application to our test project:
$ cp -r django-pki/pki django_pki_testsite/
Create certificate storage directory:
$ cd django_pki_testsite
$ mkdir PKI
Edit settings.py:
1. For convenience, at the top add:
import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
2. Configure database (for testing purposes sqlite is enough):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.abspath(os.path.join(PROJECT_PATH, 'pki.db')),
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
3. Configure path to media files and url prefixes:
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'pki', 'media')
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/admin_media/'
4. Register pki application and enable admin interface:
INSTALLED_APPS = (
# these are default for django-1.2.x
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
# and these are required for django-pki
'pki',
'django.contrib.admin',
)
5. Set certificate storage directory:
PKI_DIR = os.path.join(PROJECT_PATH, 'PKI')
Now edit urls.py to look like this:
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
handler500 = 'pki.views.show_exception'
handler404 = 'pki.views.show_exception'
urlpatterns = patterns('',
(r'^', include('pki.urls')),
(r'^admin/', include(admin.site.urls)),
)
# This is useful only for Django development web server:
if settings.DEBUG:
M = settings.MEDIA_URL
if M.startswith('/'): M = M[1:]
if not M.endswith('/'): M += '/'
urlpatterns += patterns('',
(r'^%s(?P<path>.*)$' % M,
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT,
'show_indexes': True}),
)
Configuration complete. Next, let Django create necessary database tables:
$ python manage.py syncdb
and specify default superuser account when asked. Then launch development webserver:
$ python manage.py runserver
and point your browser to http://localhost:8000/admin/
8<------------------------------------------------------------------------------
If you want to use Django-PKI in production, it is better to use Apache with mod_wsgi and mysql/postgresql database. Read some docs about Django deployment and feel free to ask for help if you have any troubles.
Hope this helps.
To be more compliant with current README, there are several minor corrections:
> 5. Set certificate storage directory:
>
> PKI_DIR = os.path.join(PROJECT_PATH, 'PKI')
>
6. Add exception logging middleware:
MIDDLEWARE_CLASSES = (
# these are default:
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# this middleware is required for pki exception logging:
'pki.middleware.PkiExceptionMiddleware',
)
Also there are bunch of optional settings to tweak, but default values are just fine. For example, you may want to change TIME_ZONE and LANGUAGE_CODE, plus add PKI_DEFAULT_COUNTRY according to your location.
> Now edit urls.py to look like this:
>
> from django.conf.urls.defaults import *
> from django.contrib import admin
> from django.conf import settings
>
> admin.autodiscover()
>
> handler500 = 'pki.views.show_exception'
This 404 handler line is unnecessary: