Pimp My Cause [Django]
Virtual Enviroment Setup
This allows you to install all the Python dependencies in a "box" so they are not globally installed and clashing with other projects.
- Install virtualenv:
pip install virtualenv
- Install virtualenvwrapper:
pip install virtualenvwrapper*You can skip this and use virtualenv installed in a step before directly, virtualenvwrapper allows for nice interfacing with virtualenv
- Source the
source /usr/local/bin/virtualenvwrapper.shNOTE: To help do this automatically on every new shell you open add the line above to your
- Create a new env for the project:
Clone the repo
- Get the code:
git clone firstname.lastname@example.org:womenhackfornonprofits/pimp-my-cause-django.git
Install Python dependencies
- Go inside the
- Activate the virtual enviroment:
workon pimpThis will now ensure anything you install is within this environment.
- Install the requirements:
pip install -r requirements.txtThis will get all the Python dependencies.
- You will need to have Postgres installed and up and running. You can install it via:
brew install postgresql
- OR download the Postgres App
- Make sure the Postgres Server is up and running:
- If using the App simply start the server from there
- If using command line:
brew services start postgresql
- Create a database locally for the project to run:
GEO Spatial dependencies
This is used to allow us to store Spatial data about user locations and calculate distance between users.
12. Install all the Geo Django dependencies using Homebrew Bundle
If you can't use Homebew, you can install the dependencies mentioned in the Brewfile manually. Django GIS Intstructions
2. Install front-end dependencies:
`cd pimpmycause` `npm install`
Running the project locally
- Go inside the django app directory:
- Run django server:
python manage.py runserver
- Go to 127.0.0.1:8000
- You may see a message that you have unapplied migrations. When you see this simply run the command below which will create any tables and fields in the database:
python manage.py migrate
Front End changes
- Make any HTML changes in the Django templates located in
npm run watchto run webpack and watch for changes.
- You will have to reload the 127.0.0.1:8000 link after adding changes
Deploying to Heroku
- Create a Heroku Account
- Get added to the app in the Heroku Dashboard (ask a team member)
- In the terminal
- Within your project directory
heroku git:remote -a staging-pimpmycause
- Once you are ready to deploy, from master branch you can run
git push heroku stagingmake sure you have committed all the changes before running this and the
git statusis clean.
- Go to https://staging-pimpmycause.herokuapp.com to view the live site.