-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
If you don't have it already, install virtualenv:
$ pip install virtualenv
If you don't have pip, you may be able to:
$ easy_install virtualenv
-
Checkout the master branch of the project repository into your service-endorsement directory:
$
git clone [email protected]:uw-it-aca/service-endorsement.git ./service-endorsement
ORgit clone https://github.com/uw-it-aca/service-endorsement.git ./service-endorsement
-
From within the new service-endorsement directory, switch to develop branch
$
git checkout develop
-
Make your service-endorsement directory into a virtualenv:
$
virtualenv service-endorsement
-
Activate your virtualenv:
$
cd service-endorsement
$
source bin/activate
-
Install required Python packages with pip:
$
pip install -r requirements.txt
-
Create a django project in service-endorsement directory:
$
django-admin.py startproject project .
That '.' at the end is important!
Make manage.py runable:
$
chmod 755 manage.py
-
Modify project/settings.py by adding the following:
Add to your INSTALLED_APPS list
'compressor',
'templatetag_handlebars',
'endorsement',
'userservice',
'authz_group',
'uw_saml',
'django_client_logger',
'supporttools'
Add the variable
DEFAULT_INDEX_TABLESPACE = ''
Change MIDDLEWARE to MIDDLEWARE_CLASSES, and add to the end of the list:
'django.contrib.auth.middleware.PersistentRemoteUserMiddleware',
'django_mobileesp.middleware.UserAgentDetectionMiddleware',
'userservice.user.UserServiceMiddleware',
In the TEMPLATES setting add to the'OPTIONS' list:
'supporttools.context_processors.supportools_globals',
'endorsement.context_processors.is_desktop'
Add mock SAML attributes for the authenticated user runserver uses for default:
LOGIN_URL = reverse_lazy('saml_login')
LOGOUT_URL = reverse_lazy('saml_logout')
MOCK_SAML_ATTRIBUTES = {
'uwnetid': ['jstaff'],
'affiliations': ['employee', 'member'],
'eppn': ['[email protected]'],
'scopedAffiliations': ['[email protected]', '[email protected]'],
'isMemberOf': ['u_test_group', 'u_test_another_group',
'u_acadev_provision_support'],
}
Add variables for safe email backend to test notifications
EMAIL_BACKEND = 'saferecipient.EmailBackend'
EMAIL_HOST = 'appsubmit.cac.washington.edu'
EMAIL_NOREPLY_ADDRESS = 'Service Endorsement <[email protected]>'
SAFE_EMAIL_RECIPIENT = '[email protected]'
And finally add and edit the filename paths as desired:
MEDIA_URL = '/media/'
MEDIA_ROOT = 'media/'
STATIC_URL = '/static/'
STATIC_ROOT = '/tmp/static'
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
"compressor.finders.CompressorFinder",
)
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
SUPPORTTOOLS_PARENT_APP = "Svc En't"
SUPPORTTOOLS_PARENT_APP_URL = "/"
# django mobileesp
from django_mobileesp.detector import mobileesp_agent as agent
DETECT_USER_AGENTS = {
'is_tablet': agent.detectTierTablet,
'is_mobile': agent.detectMobileQuick,
}
COMPRESS_ROOT = "/tmp/"
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc {infile} {outfile}'),
('text/x-sass', 'pyscss {infile} > {outfile}'),
('text/x-scss', 'pyscss {infile} > {outfile}'),
)
COMPRESS_ENABLED = False
COMPRESS_OFFLINE = False
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.RemoteUserBackend',
]
AUTHZ_GROUP_BACKEND = 'authz_group.authz_implementation.all_ok.AllOK'
USERSERVICE_ADMIN_GROUP = ''
RESTCLIENTS_ADMIN_GROUP = ''
RESTCLIENTS_DAO_CACHE_CLASS = 'restclients_core.cache.NoCache'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(asctime)s %(levelname)s %(message)s'
},
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'endorsements_file': {
'level': 'DEBUG',
'formatter': 'simple',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/tmp/endorsements.log',
'when': 'midnight',
'interval': 1,
'backupCount': 7
},
'sws_file': {
'level': 'DEBUG',
'formatter': 'simple',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/tmp/sws_client.log',
'when': 'midnight',
'interval': 1,
'backupCount': 7
},
'gws_file': {
'level': 'DEBUG',
'formatter': 'simple',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/tmp/gws_client.log',
'when': 'midnight',
'interval': 1,
'backupCount': 7
},
'pws_file': {
'level': 'DEBUG',
'formatter': 'simple',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/tmp/pws_client.log',
'when': 'midnight',
'interval': 1,
'backupCount': 7
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
},
'loggers': {
'sws': {
'handlers': ['sws_file'],
'level': 'DEBUG'
},
'gws': {
'handlers': ['gws_file'],
'level': 'DEBUG'
},
'pws': {
'handlers': ['pws_file'],
'level': 'DEBUG'
},
'endorcements': {
'handlers': ['endorsements_file'],
'level': 'DEBUG'
},
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
- Update project/urls.py by changing it to:
from django.conf.urls import url, include
#from django.contrib import admin
urlpatterns = [
#url(r'^admin/', admin.site.urls),
url(r'^saml/', include('uw_saml.urls')),
url(r'^support', include('userservice.urls')),
url(r'^logging/', include('django_client_logger.urls')),
url(r'^', include('endorsement.urls')),
]
-
Set the environment variable
$
export DJANGO_SETTINGS_MODULE=project.settings
-
Set up the database >$
./manage.py migrate
-
Run your development server: >$
export REMOTE_USER=jstaff
>$ `./manage.py runserver 0.0.0.0:<your port>`