The ASPC main site is developed and maintained by the ASPC Digital Media and Programming Group, a subsidiary of ASPC's communications arm. The goal of the main site is to provide useful and reliable services, tools, and information to the ASPC constituency - namely the students of Pomona College.
The ASPC main site is deployed at https://aspc.pomona.edu.
Under the main aspc
folder in this directory are several subfolders, most of
which are Django "apps":
activityfeed
- Feed of activity on Twitter, SageBooks, etc. (shown on homepage)api
- API for ASPC apps: please see the API README for more informationauth2
- CAS auth backend for 5C accountsblog
- The senate blog (shown on homepage)courses
- Course search and schedule buildereatshop
- Local business and discount directoryevents
- 5C event calendar and scraper (shown on homepage)folio
- Simple CMS to add basic HTML pages to the sitehousing
- Housing directory and reviewsmenu
- 5C weekly dining hall menus (shown on homepage)minutes
- History of ASPC minutes and summariessagelist
- Aka SageBooks, student-to-student textbook salessenate
- Senate positions, appointments, and documents
Folders without an __init__.py
are not apps, but contain supporting files:
static
- Static assets (CSS/JavaScript/Images/Fonts) used in the sitetemplates
- Certain site-wide templates that don't fit into a particular app
And some apps are placeholders that have yet to be fleshed out or removed:
auth1
- Legacy LDAP auth backend for Pomona College accountscollege
- Contains assortment of generic college-based models and tasks that need to be refactored
We now have an API for the 5C Menu and Course. Please see the API README for more details.
The ASPC main site is an open-source project that welcomes contributions from the community. If you want to be paid for your work, you should apply for a job in the ASPC Digital Media and Programming Group!
-
To start hacking on the ASPC main site, you will need Vagrant, a tool that will allow you to create a VM running on your machine that resembles our production environment. Vagrant runs on Windows, OS X, and Linux.
-
Fork the ASPC repository and clone it to your computer.
-
Create a
settings.py
file by copyingsettings.py.example
and filling in any configuration settings specific to your instance. -
Once you have done that and you have Vagrant installed, navigate to the directory where you cloned the repo, and run:
vagrant up
-
This starts the VM, which contains an
nginx
instance that serves the main site. Vagrant will also run init scripts to populate Django and the database with fake data and fixtures so as to thoroughly micmic our production environment. To see the site in action, visit http://localhost:8080, or whichever port you configured Vagrant to forward connections onto the VM's port 80. -
To access the admin interface, log in with username
developer
and passworddeveloper
using the "Guest Login" button on the homepage. To run management commands, you'll need to SSH in to the VM:$ vagrant ssh vagrant$ cd /vagrant vagrant$ ./manage.py
-
If you're working on the courses app, run the tests with
coverage run manage.py test; coverage html --include=/vagrant/aspc/courses/*
. Open uphtmlcov/index.html
to view coverage. -
When you're done working, free up system resources with a
vagrant halt
. If you want to start from scratch,vagrant destroy
and thenvagrant up
anew. Applying future changes to the Vagrant setup will be done automatically when youvagrant up
, but you can also runvagrant provision
yourself.
GUnicorn workers have max_requests = 1
set in vagrant/gunicorn.cfg.py
. This means that after at most one refresh, the worker will be running your code. If you need to force a reload, run vagrant ssh -c "/vagrant/vagrant/gunicorn.sh reload"
.
When you have finished making changes on whatever branch in your forked repo, simply open a pull request against ASPC's master
to signal that you'd like to merge them in. One of the ASPC developers will review the request, merge, and deploy it if it is appropriate. Feel free to contact digitalmedia@aspc.pomona.edu with any questions!
If you cannot use Vagrant for some reason, you can always get the main site running locally the old-fashioned way. To do this, you need Python >= 2.7 (<3.0), PostgreSQL, virtualenv, virtualenvwrapper, and some patience. These instructions assume you are using a Mac with Homebrew installed.
brew install unixodbc # needed to compile pyodbc
brew install freetds # needed to connect to JICSWS
brew intall postgresql # for running a server locally
mkvirtualenv aspc
cd /path/to/your/mainsite/repo
pip install -r requirements.txt # this will take a while
# to start the PostgreSQL server before starting work:
postgres -D /usr/local/var/postgres
# alternatively, set it to start at login...
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
# ...and launch it now
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# create the db
createdb
psql -c "CREATE ROLE main LOGIN PASSWORD 'dev_password';"
psql -c "CREATE DATABASE main_django WITH ENCODING = 'UTF-8' LC_CTYPE = 'en_US.UTF-8' LC_COLLATE = 'en_US.UTF-8' OWNER main TEMPLATE template0"
# create db tables and superuser
./manage.py migrate
# load default data
./manage.py loaddata ./fixtures/*
# load housing data
./manage.py load_dorms
./manage.py load_maps
./manage.py load_dorm_rooms