This is the website for www.personalgenomes.org, implemented using Django. This enables our site to use IP address to display defaualt content based on the country a viewer is in, and to allow Austrian users to view a German version of their site. So far no database features have been used, although there's a chance we'll use such features in the future.
Personal Genome Project sites (e.g. Harvard, Canada, UK) each have a subsite within www_personalgenomes_org in the form of an app directory. This gives you a lot of flexibility to add features and content relevant to your PGP site.
By default we are giving developers "read only" access to the PersonalGenomesOrg repository. You can submit changes to the site in the form of pull requests.
To do this, you should:
- Fork the repository to create a copy in your own GitHub account.
- Clone the repository to your local machine from the version in your Github account:
git clone git@github.com:YourUsername/www_personalgenomes_org
- Add the PersonalGenomesOrg as an "upstream" repository as described here.
- Edit the site on the local machine and commit changes.
- (Necessary before doing step 7.) Pull upstream changes from the PersonalGenomesOrg repository (and have these in your Github repository) before sending a pull request.
- Push changes to your Github repository.
- Send a "pull request" to the PersonalGenomesOrg repository on Github.
- Email madeleine@personalgenomes.org to notify Madeleine of the requested update.
So far these instructions have been used for Ubuntu Linux 12.10 and OSX Mountain Lion. If you use another system, please go ahead and submit modifications to this file to describe alternate instructions. Thanks!
If you aren't familiar with pip and virtualenv: these are standard aspects of Python development, greatly facilitating package management. Whenever working on this software you should do so within the virtual environment.
Skip if you already have these set up, of course.
You can use any plain text editing tool for editing various files (like .bashrc), TextWrangler worked for us.
These instructions are adapted from here and here.
- To make sure compilers know what architecture your system is (64 bits), add the following to your
~/.bash_profile
(or create a.bash_profile
in your home directory if it doesn't already exist).
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc
-
Close and open a new terminal (or tab) to have this configuration take effect.
-
Go to Apple's Developer Downloads area (Apple ID login will be required) and download the Command Line Tools for Xcode and install it.
-
Install Homebrew following the instructions on their site http://brew.sh/
-
run
brew doctor
to check all is well. -
run
brew update
to make sure it's up-to-date. -
run
brew install geoip postgresql
to install the GeoIP library and PostgreSQL if needed. -
run
brew install python --with-brewed-openssl
to install Python from Homebrew. -
run
pip install virtualenv virtualenvwrapper
to install virtualenv using pip, our Python package manager of choice. -
Make a directory to store your virtual environments:
mkdir ~/.virtualenvs
-
To make virtualenv and virtualenvwrapper commands work in future terminals, add the following to your
~/.bashrc
(or create a.bashrc
file in your home directory if one doesn't exist):export WORKON_HOME=$HOME/.virtualenvs
andsource /usr/local/bin/virtualenvwrapper.sh
.
- (Root user action) Install python/pip dependencies:
sudo apt-get install python-pip python-dev
- (Root user action) Use pip to install virtualenv and virtualenvwrapper:
sudo pip install virtualenv virtualenvwrapper
- Make a directory to store your virtual environments:
mkdir ~/.virtualenvs
- To make virtualenv and virtualenvwrapper commands work in future terminals, add the
following to your
~/.bashrc
(or zshrc, as appropriate):export WORKON_HOME=$HOME/.virtualenvs
andsource /usr/local/bin/virtualenvwrapper.sh
.
If you open a new terminal you should now be able to access the virtualenvwrapper commands listed below.
- Create a new virtual environment for working on this code:
mkvirtualenv www_pg_org
- Start using this virtual environment:
workon www_pg_org
- Navigate to top directory in this project. Install the Python packages required for development with
pip install -r requirements.txt
- Also while in the top directory in the project, run the following to add the directory to your
virtualenv's python path:
add2virtualenv $PWD
In the future, you should run the workon www_pg_org
command whenever you work on and run this code.
You can run the site now by navigating to the top directory of the project and running
python manage.py runserver --insecure
. You can then load the site by opening a web browser and
navigating to http://localhost:8000
.
Because the development settings (which are default) use SQLite, no additional installation of database software should be needed for local development. (SQLite is included in Python.)
[fill in later]