SEO London Django Website
Created and built by Mindspray, Glendelm Design, Spoke and Women Hack For Non-Profits
How to set up a development environment
Please try following instructions in Vagrant first. The instruction here is left for reference only.
Prerequisite:
- a github account
- a fork of Woman Hack for Non Profit's SEO London repository in your account:
- login to your github account
- goto
https://github.com/womenhackfornonprofits/seo-london
, - click fork icon in the upper left column
Set up Python / Virtualenv / requirements
Here we want to set up a python virtual environment and set up a source code
- Install Python:
brew install python
- Upgrade pip & setup tools:
pip install --upgrade pip setuptools wheel
- Install virtualenv:
pip install virtualenv
- Install virtualenvwrapper:
pip install virtualenvwrapper
- Source the virtualenvwrapper:
source /usr/local/bin/virtualenvwrapper.sh
- Note: To help do this automatically on every new shell you open add the line above to your .bash_profile or .bashrc
- Create a new env for the project:
mkvirtualenv seolondon
- To activate the virtualenv:
workon seolondon
, when finished to de-activate type in:deactivate
- Clone the forked repo:
git clone git@github.com:<your git username>/seo-london.git
- Go inside the new seo project directory:
cd seo-django
- Install python requirements:
pip install -r requirements.txt
- Install frontend requirements:
npm install
Install Postgres Database Server
- You will need to have Postgres installed and up and running. You can install it via:
- Homebrew
brew install postgresql
- OR Download the Postgres App
- Homebrew
- Make sure the Postgres Server is up and running:
- If using the App simply start the server from there (Mac)
- If using command line:
brew services start postgresql
(Mac)
- Create a new database:
createdb seolondon
- NOTE: do not run migrations as we will import the whole database
- Create a user:
- run
psql
- then run
CREATE USER seolondon PASSWORD 'seolondon'
- run
Loading data locally (very desirable but optional)
Downlowd a postgresql dump and media dump.
- Get the database backup file (TBD)
- Unzip the file to a file name called
latest.dump
- Import the database into the local database (add
--clean
if you need it emptied) (this is a one line command):pg_restore --verbose --no-acl --no-owner -h localhost -U seolondon --role seolondon -d seolondon latest.dump
- copy public media files to local
(there will be a lot of print out, after this you should have files in
web/media/
folders):python manage.py copy_media_file
Running the project locally
- Go inside the new seo project directory:
cd seo-django
- Run gulp to compile and watch for changes:
gulp
- In a different console run
npm run server
(simultaneously with gul) - In a new concole also run
python manage.py runserver
Troubleshooting
- "Missing module...": Probably because you didn't activate the environment
source ../env/bin/activate
; or install the requirements inside the environmentpip install -r requirements.txt
.
Production Environment
This section is for users with a bit more experience, or already accustomed with the setup.
Additional accounts required
- AWS Credentials for S3
- IFramely for blog video embed
- Google Analytics / Google Tag Manager Code
I think it is probably best to do heroku configs
to get all the production configuration.
Download Database
- Database
- Get a dump from Heroku:
heroku pg:backups:capture
- Fetch the database dump to your machine:
heroku pg:backups:download
- Get a dump from Heroku: