website
If you're getting image not found:
export DYLD_LIBRARY_PATH=/Applications/Postgres.app/Contents/Versions/9.3/lib
Coding Conventions:
- Use "_" for filenames
- User "-" for class names
- Use Font Awesome for icons
- Don't use JS if it's doable using CSS3
- Use good markup: Make things extensible, use classes and IDs efficiently, use the right semantics
Setup (for devs)
Installation (For Mac -- skip if windows)
- Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Have Python 3 installed (
brew install python3
) - Have
pip3
installed (Should come with step 2) - Install
virtualenv
by doingpip3 install virtualenv
Terminal stuff
- Clone this git repo
- In the git repo, create a virtual env
virtualenv --python=/path/to/python3 venv
You probably can get away withvirtualenv venv
, but if you see python2.7 somewhere in the command log. Use stackoverflow to find where your python3 is installed.
--python
lets you choose which Python installation to use. If you have something like Anaconda-Python, perhaps you want to use the Homebrew Python3 instead
- Start the virtual env:
source venv/bin/activate
- Install postgres (Google postgres.app)
- Remember to add postgres to path in
~/.bash_profile
:PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
. Then, addexport PATH
AND RESTART TERMINAL
- Note: You have to match the installed Postgres version, not the path here
- Install requirements
pip3 install -r requirements.txt
Setting up Postgres
- Open the Postgres app to start the Postgres server
- Inside the postgres server shell use
psql
to enter shell, runCREATE DATABASE upe_db;
. Don't forget the semicolon. - Also run
CREATE USER admin WITH PASSWORD 'littlewhale';
. - Type
\q
to quit the postgres server shell.
Final Stretch: Getting Django to run
- Now you are ready to do
python3 manage.py syncdb
- If successful, Django should ask you to install superusers. Say yes, and use a one-character username/password for ease.
- Now you can run
python3 manage.py runserver
. This will be your go-to command when you develop. - Visit
localhost:8000
in your server. You should now see the UPE website locally! - Wrapping up: you can do Ctrl-C to stop the server, and then run
deactivate
in the terminal to stop the virtualenv.
To change your local django admin username/password
- To change the password: follow the instructions here
- To change the username:
python3 manage.py runserver
, then go tolocalhost:8000/admin
>Users and modify the user.
Server Deployment Checklist
- Make sure models are good to go:
python3 manage.py migrate
. (makemigrations
should be done locally and then committed to Git) - If any static files are changed, update them on the server:
python3 manage.py collectstatic
- If any Python files are changed, restart the server:
sudo initctl restart uwsgi
Mailing List Documentation
To make sure that the update script (update.sh
) runs, the owner of all the postfix-related files must be postfix
.
- e.g. if edits to
virtual
changes the owner, dochmod postfix virtual
.