PSU-Base
Reusable Django app specifically for PSU's custom-built web applications.
It encapsulates the common functionality that we would otherwise need to program into each application we build.
Features include:
- PSU Single Sign-On (SSO)
- Authentication and authorization features
- Feature toggles
- Template tags for our static content server
Quick Start
Dependencies
The following dependencies may be REQUIRED in your system:
libpq-devsudo apt install libpq-dev
Installation
pip install psu-base
Configuring Your App
-
Add PSU-Base and its two required apps to INSTALLED_APPS in
settings.py:INSTALLED_APPS = [ ... 'django_cas_ng', 'crequest', 'psu_base', ]
-
Copy
docs/app_settings_template.pyto your app, name itapp_settings.pyand update the values as needed. -
Copy
docs/local_settings_template.pyto your app, name itlocal_settings.pyand update the values as needed. -
Import your app and local settings files at the end of your settings.py file:
settings.py
# Get app-specific settings
from .app_settings import *
# Override settings with values for the local environment
from .local_settings import *
-
Run
python manage.py migrateto create the PSU-Base models in your development database -
Configure your app's top-level
urls.pyto include PSU URLs# my_app/urls.py from django.conf import settings from django.conf.urls import url from django.urls import path, include ... urlpatterns = [ ... # PSU and CAS views are defined in psu_base app url(settings.URL_CONTEXT+'/psu/', include(('psu_base.urls', 'psu_base'), namespace='psu')), url(settings.URL_CONTEXT+'/accounts/', include(('psu_base.urls', 'psu_base'), namespace='cas')), ]
Usage
Usage of the psu-base app is documented in Confluence.
For Developers
The version number must be updated for every PyPi release.
The version number is in psu_base/__init__.py
Document Changes
Record every change in docs/CHANGELOG.txt Document new features or significant changes to existing features in Confluence.
Publishing to PyPi
- Create accounts on PyPi and Test PyPi
- Create
~/.pypirc[distutils] index-servers= pypi testpypi [testpypi] repository: https://test.pypi.org/legacy/ username: mikegostomski password: pa$$w0rd [pypi] username: mikegostomski password: pa$$w0rd - Ask an existing developer to add you as a collaborator - test and/or prod
python setup.py sdist bdist_wheel --universaltwine upload --repository testpypi dist/*twine upload dist/*- Tag the release in Git. Don't forget to push the tag! Example:
git tag 0.1.2
git push origin 0.1.2
Release files for psu-base 0.2.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| psu_base-0.2.9-py3-none-any.whl | Python 3 | none | any | Details |
Release files / psu_base-0.2.9-py3-none-any.whl
| Download URL | psu_base-0.2.9-py3-none-any.whl |
|---|---|
| Size | 101.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cbab3219ee8bd8d14a8ed4d2e5bf902e38e5f3912c437bfd885afac5c7cbd39
|
|
BLAKE2b-256 checksum How to use checksums |
33d9bae3b0e547f59ec0df1a021a103c10f5921d85db33b5a2d6ccd55c4a43c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|