Installation - uw-it-aca/myuw GitHub Wiki
These directions will get you started with the Django development server, running MyUW as javerage.
Prerequisites
A Python installation 3.6
pip or easy_install
git
virtualenv3
Checkout the master of the myuw project:
git clone https://github.com/uw-it-aca/myuw.git
OR
git clone [email protected]:uw-it-aca/myuw.git
Turn myuw into a virtualenv:
/usr/local/bin/virtualenv3 myuw
Activate your virtualenv:
cd myuw
source bin/activate
Upgrade your setuptools:
pip install setuptools --upgrade
Install required Python packages with pip:
pip install -e .
If you receive errors with the above, ensure you have lib32z1-dev, libxslt1-dev, libxml2-dev, libxmlsec1-dev, and python-dev installed.
Create a django project in the myuw dir:
django-admin.py startproject project .
That '.' at the end is important!
Modify at least the following settings in project/settings.py:
For INSTALLED_APPS, add:
'compressor',
'rc_django',
'django_mobileesp',
'templatetag_handlebars',
'myuw',
'userservice',
'django_client_logger',
'supporttools',
'blti',
'hx_toolkit'
You need to use MIDDLEWARE_CLASSES instead of MIDDLEWARE. Add these:
'django.contrib.auth.middleware.RemoteUserMiddleware',
'userservice.user.UserServiceMiddleware',
'django_mobileesp.middleware.UserAgentDetectionMiddleware',
'rc_django.middleware.EnableServiceDegradationMiddleware',
The full list should look something like:
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django_mobileesp.middleware.UserAgentDetectionMiddleware',
'userservice.user.UserServiceMiddleware',
'rc_django.middleware.EnableServiceDegradationMiddleware',
]
Below that add:
AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.RemoteUserBackend', )
USERSERVICE_VALIDATION_MODULE = "myuw.authorization.validate_netid"
USERSERVICE_OVERRIDE_AUTH_MODULE = "myuw.authorization.can_override_user"
RESTCLIENTS_ADMIN_AUTH_MODULE = "myuw.authorization.can_proxy_restclient"
MYUW_DISABLE_ACTIONS_WHEN_OVERRIDE = True or False
MEDIA_URL = '/media/'
MEDIA_ROOT = 'media/'
STATIC_URL = '/static/'
STATIC_ROOT = 'static/'
MAILMAN_COURSEREQUEST_RECIPIENT = ""
Change TIME_ZONE to 'America/Los_Angeles'
In addition, certain functionality may be disabled by default. Too enable, add or modify:
MYUW_ENABLED_FEATURES = []
To enable teaching page add 'instructor_schedule' in the list. To enable instructor textbooks add 'instructor_textbooks' to this list.
To use Saml authentication, add
MOCK_SAML_ATTRIBUTES = {
'uwnetid': ['javerage'],
'affiliations': ['student', 'member', 'alum', 'staff', 'employee'],
'eppn': ['[email protected]'],
'scopedAffiliations': [
'[email protected]',
'[email protected]'],
'isMemberOf': [
'u_test_group', 'u_test_another_group',
'u_astratest_myuw_test-support-admin'],
}
from django.core.urlresolvers import reverse_lazy
LOGIN_URL = reverse_lazy('saml_login')
LOGOUT_URL = reverse_lazy('saml_logout')
If you're not running your dev server on your local computer, you'll need to update your ALLOWED_HOSTS setting. If you're on axd3, it should be this:
ALLOWED_HOSTS = ['axd3.s.uw.edu']
Add include to your imports in project/urls.py:
from django.conf.urls import url, include
Map urls to the myuw_mobile app by adding the following to urlpatterns in project/urls.py:
url(r'^support', include('userservice.urls')),
url(r'^logging', include('django_client_logger.urls')),
url(r'^', include('myuw.urls')),
url(r'^logging', include('rc_django.urls')),
url(r'^saml/', include('uw_saml.urls')),
Migrate your database:
python manage.py migrate
You should now be able to run your development server (on AXD3, use port 8000-10000):
REMOTE_USER=javerage python manage.py runserver 0.0.0.0:<your port>
If you are using AXD3 you can view your development server at http://axd3.s.uw.edu: