Skip to content

Getting Started (on Mac or Linux)

wrongu edited this page Apr 11, 2014 · 3 revisions

Setting up a development environment

  1. Make an account on github

  2. Using github, make a fork of this repository (got to github.com/HarleyCommons/commonssite and click on 'Fork')

  3. Make a directory "~/code" on your machine

  4. From the command-line, navigate to "~/code" and run git clone git@github.com:your-user-name/commonssite.git

  5. (if you don't have it already, install Python and pip. You can check if you have them by running which python and which pip from the command line).

  6. Download and install virtualenv with pip by running sudo pip install virtualenv (if you aren't an administrator on your computer, install it locally with pip install virtualenv --user)

  7. Make a directory "/your/username/.virtualenv". Go there in the command line and run virtualenv --system-site-packages Django (if you installed virtualenv with --user, you may need to find where it is first.. on my machine it was "/your/username/.local/bin/virtualenv")

  8. Open the file "/your/username/.virtualenv/Django/bin/activate" with your editor of choice. In the blank space after "export PATH", add the following:

     export PYTHONPATH="~/code:$PYTHONPATH"
     export DJANGO_SETTINGS_MODULE="commonssite.server.webapp.settings"
    
  9. That's pretty much it for setup! Now when you run source ~/.virtualenv/Django/bin/activate, you should be able to run any of the code in the commonssite repository. Just type deactivate to get out of that virtual environment. Since that's a lot of typing, a shortcut is to modify "/.bash_aliases" (or "/.bashrc" if it doesn't exist) with the following:

     alias djenv='source ~/.virtualenv/Django/bin/activate'
    

Now run source ~/.bashrc, and you should be able to start our new Django environment just by typing djenv

One last thing is that there are two configuration files, sql_creds.txt and private.py, which are required to run the server, but aren't provided on github for security reasons. Contact 'rlange at harleyschool dot org' for more info or to get the required files

Contributing

To submit your changes, go to github.com/HarleySchool/commonssite and click on 'Pull Request'