Website for the Global Education Observatory platform. Built with Django 4 on Python 3.9. HTML template is Editorial by HTML5 UP. Integrates with W&M CAS for authentication using django-cas-ng. Serves static files using whitenoise. Any pushes to master
branch is mirrored to an internal repo at https://code.wm.edu, which builds a Docker container using the Dockerfile and uploads it to the W&M Docker registry. Updates get picked up from the registry and become live at https://geo.ds.wm.edu within a few minutes.
- Clone this repo
- Create a Python 3.9 virtual environment with
python -m venv .venv
- Activate the venv
- Windows/Powershell:
.venv/Scripts/Activate.ps1
- Linux/Most shells:
source .venv/bin/activate
- Windows/Powershell:
- Install requirements with
pip install -r requirements.txt
- Note:
mysqlclient
may require additional steps to get to build. Linux should havedefault-libmysqlclient-dev
,build-essential
, andpython3-dev
orpython3.9-dev
depending on system Python install. Windows should choose amysqlclient
version with prebuilt binaries. See https://pypi.org/project/mysqlclient/.
- Note:
- [Optional] Install eslint and prettier with
npm install
for Javascript linting and formatting - Set up the following environment variables:
DEBUG
Set totrue
for testing. Enables the debug sidebar and outputs stacktrace to the browser. Set tofalse
for production. Defaults totrue
.- Note: These are all-lowercase strings.
SECRET_KEY
Long random string used to add entropy to cryptography. Not required when testing.DB_NAME
Name of the database schema (production), or full path of the sqlite file (test)DB_ENGINE
Usedjango.db.backends.mysql
(production) ordjango.db.backends.sqlite3
(test). Note that SQLite does not support spatial data types by default.DB_USER
Username for MySQL. Not used for SQLite.DB_PASSWORD
Password for MySQL. Not used for SQLite.DB_HOST
Address of the MySQL server. Not used for SQLite.- Note: The production MySQL server is on an internal network and will not accept outside connections. To access it for local development, you will need to use an SSH tunnel through a trusted machine.
DB_PORT
Port of the MySQL server. Not used for SQLite. Use3306
.CAS_SERVER_URL
URL of the W&M CAS server. Usehttps://cas.wm.edu/cas/
.- Tip: Set up these variables in a shell script, then you can just run
source envs.sh
to add all of them at once.
- Start the development server with
python cms/manage.py runserver 8080
- Note: Local port must be 8080 or W&M CAS will reject authentication requests.