If you're getting image not found:
export DYLD_LIBRARY_PATH=/Applications/Postgres.app/Contents/Versions/9.3/lib
General Conventions:
- Simpler models are better
- Commit all of your migration scripts
- Don't commit unnecessary stuff (settings.py...)
- It's too late now, but try not to store things like passwords and auth in code for the future
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
- snake_case for variables and functions, CamelCase for objects and models
- 4 spaces per tab, spaces only
- Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - Have Python 3 installed (
brew install python3) - Have
pip3installed (Should come with step 2) - Install
virtualenvby doingpip3 install virtualenv
- Clone this git repo
- In the git repo, create a virtual env
virtualenv --python=/path/to/python3 venvYou probably can get away withvirtualenv venv, but if you see python2.7 somewhere in the command log. Use the commandwhich python3to figure out where python3 is installed.
--pythonlets 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 mysql 5.5 (Google mysql 5.5. install; on Debian/Ubuntu, should need to use apt to install
mysql-client,mysql-server,libmysqlclient-devand its dependencies)
- You should get a config asking you to set a root password when installing
mysql-server. Set this to something you'll remember.
- Install requirements
sudo pip3 install -r requirements.txt
- Ensure your mysql server is running
- Enter the shell with the command
mysql -u root -pto login as root. Enter the password you made earlier. - Create the
upedatabse by running the commandCREATE DATABASE upe;my - Also run
CREATE USER admin IDENTIFIED BY 'littlewhale';. Then grant your user permissions:GRANT ALL PRIVILEGES ON upe.* TO 'admin'; - Type
\qto quit the mysql server shell.
- Rename the template
settings.py.templatetosettings.py. Never commit this! - 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:8000in your server. You should now see the UPE website locally! - Wrapping up: you can do Ctrl-C to stop the server, and then run
deactivatein the terminal to stop the virtualenv.
You can load some of the old data into the database for testing purposes. Here's how
20. Get the database dump json file from your lovely committee chairs
21. Run the following command: python3 manage.py loaddata /path/to/json/file and your data will be loaded!
- 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.
- Make sure models are good to go:
python3 manage.py migrate. (makemigrationsshould be done locally and then committed to Git) - If any static files are changed, update them on the server:
python3 manage.py collectstatic
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
virtualchanges the owner, dochown postfix virtual.