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:
mysqlclientmay require additional steps to get to build. Linux should havedefault-libmysqlclient-dev,build-essential, andpython3-devorpython3.9-devdepending on system Python install. Windows should choose amysqlclientversion with prebuilt binaries. See https://pypi.org/project/mysqlclient/.
- Note:
- [Optional] Install eslint and prettier with
npm installfor Javascript linting and formatting - Set up the following environment variables:
DEBUGSet totruefor testing. Enables the debug sidebar and outputs stacktrace to the browser. Set tofalsefor production. Defaults totrue.- Note: These are all-lowercase strings.
SECRET_KEYLong random string used to add entropy to cryptography. Not required when testing.DB_NAMEName of the database schema (production), or full path of the sqlite file (test)DB_ENGINEUsedjango.db.backends.mysql(production) ordjango.db.backends.sqlite3(test). Note that SQLite does not support spatial data types by default.DB_USERUsername for MySQL. Not used for SQLite.DB_PASSWORDPassword for MySQL. Not used for SQLite.DB_HOSTAddress 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_PORTPort of the MySQL server. Not used for SQLite. Use3306.CAS_SERVER_URLURL 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.shto 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.