Skip to content

Commit

Permalink
Merge branch 'master' into visual-update
Browse files Browse the repository at this point in the history
  • Loading branch information
serahkiburu committed Jul 25, 2018
2 parents 2fe8269 + f5da18e commit c84c7b5
Show file tree
Hide file tree
Showing 25 changed files with 305 additions and 1,474 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .bowerrc
@@ -1,3 +1,4 @@
{
"directory": "static/vendor"
"directory": "static/vendor",
"registry": "https://registry.bower.io"
}
1 change: 1 addition & 0 deletions .dockerignore
@@ -0,0 +1 @@
static/vendor
35 changes: 35 additions & 0 deletions .env.example
@@ -0,0 +1,35 @@
# Public
AWS_STORAGE_BUCKET_NAME="<change me>"
CONTACT_EMAIL_SENDER="<change me>"
DJANGO_ADMINS="name1 <email1>, name2 <email2>"
DJANGO_ALLOWED_HOSTS="okfn.org,www.okfn.org"
DJANGO_AWS_S3_CUSTOM_DOMAIN="<change me>"
DJANGO_COMPRESS_OFFLINE="true"
DJANGO_CUSTOM_ASSETS_DOMAIN="<change me>"
DJANGO_DEBUG="false"
DJANGO_EMAIL_DEBUG="false"
DJANGO_EMAIL_HOST="<change me>"
DJANGO_EMAIL_PORT="<change me>"
DJANGO_EMAIL_USE_TLS="true"
DJANGO_GOOGLE_ANALYTICS_DOMAIN="<change me>"
DJANGO_GOOGLE_ANALYTICS_TRACKING_ID="<change me>"
DJANGO_MANAGERS="name1 <email1>, name2 <email2>"
DJANGO_SECURE="true"
DJANGO_USE_AWS_STORAGE="true"
GENERAL_EMAIL_RECEPIENTS="name1 <email1>, name2 <email2>"
PRESS_EMAIL_RECEPIENTS="name1 <email1>, name2 <email2>"
SERVICE_EMAIL_RECEPIENTS="name1 <email1>, name2 <email2>"

# Private
AWS_ACCESS_KEY_ID="<change me>"
AWS_SECRET_ACCESS_KEY="<change me>"
CACHE_URL="redis://localhost:6379/0"
DATABASE_URL="postgres://user:pass@localhost:5432/okfn"
DJANGO_CSP_REPORT_URI="<change me>"
DJANGO_EMAIL_HOST_USER="<change me>"
DJANGO_EMAIL_HOST_PASSWORD="<change me>"
DJANGO_MAILCHIMP_TOKEN="<change me>"
DJANGO_MAILCHIMP_URL="<change me>"
DJANGO_SECRET_KEY="<change me>"
HUBOT_API_KEY="<change me>"
SEARCH_URL="http://localhost:9200"
7 changes: 6 additions & 1 deletion .gitignore
Expand Up @@ -26,6 +26,11 @@ node_modules
media
staticfiles

logfile
# Packages installed by bower
static/vendor/

# Extra
logfile
.projectile
.env
whoosh_index
Empty file removed .heroku/collectstatic_disabled
Empty file.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -2,9 +2,13 @@ language: python
python:
- 2.7
install:
- npm i -g npm
- npm install
- pip install -r requirements.dev.txt
- pip install coveralls
before_script:
- npm install -g bower
- bower install
script:
- coverage run manage.py test
- flake8 .
Expand Down
37 changes: 37 additions & 0 deletions Dockerfile
@@ -0,0 +1,37 @@
FROM python:2.7
MAINTAINER Open Knowledge International

WORKDIR /app
RUN apt-get update
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

COPY article_list_item ./article_list_item
COPY contrib ./contrib
COPY docs ./docs
COPY foundation ./foundation
COPY lib ./lib
COPY sendemail ./sendemail
COPY static ./static
COPY templates ./templates
COPY tools ./tools
COPY .bowerrc .
COPY bower.json .
COPY manage.py .
COPY package-lock.json .
COPY package.json .
COPY requirements.txt .

RUN pip install -r requirements.txt
RUN . /root/.nvm/nvm.sh && nvm install 10
RUN . /root/.nvm/nvm.sh && nvm use 10
RUN . /root/.nvm/nvm.sh && npm install -g bower
RUN . /root/.nvm/nvm.sh && bower install --allow-root

ENV PORT 80
EXPOSE $PORT

CMD python manage.py migrate && \
python manage.py update_index && \
gunicorn foundation.wsgi:application \
--access-logfile '-' \
--error-logfile '-'
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

1 change: 0 additions & 1 deletion Procfile.dev

This file was deleted.

71 changes: 33 additions & 38 deletions README.md
@@ -1,19 +1,15 @@
# foundation

This is the [Django][dj]/[Django CMS][djcms] project that runs <http://okfn.org>.

[dj]: https://www.djangoproject.com/
[djcms]: https://www.django-cms.org/
# okfn.org

[![Build Status](https://travis-ci.org/okfn/website.svg?branch=master)](https://travis-ci.org/okfn/website)
[![Coverage Status](https://coveralls.io/repos/github/okfn/website/badge.svg?branch=master)](https://coveralls.io/github/okfn/website?branch=master)

This is the [Django](https://www.djangoproject.com/)/[Django CMS](https://www.django-cms.org/) project that runs <http://okfn.org>.

## Prerequisites and assumptions

You must have the following installed:

- Python 2.7
- libmemcached (`brew install libmemcached` on Mac OS X using [Homebrew](http://brew.sh/))
- node

Also, the python packages being used require the following libraries to be installed:
Expand All @@ -26,34 +22,33 @@ You may also wish to follow any install instructions inside a Python virtual env

## Running in development

pip install -r requirements.dev.txt
pip install honcho
npm ci
python manage.py migrate
honcho -f Procfile.dev start

## Running on Heroku

Please note that the following are by no means full instructions. There are a
number of config variables that will also need setting before the application
will work. These will be documented in due course.

heroku create
heroku labs:enable user-env-compile
heroku addons:add heroku-postgresql
heroku addons:add mandrill
heroku config DJANGO_DEBUG=false \
DJANGO_COMPRESS_OFFLINE=true \
...
git push heroku master
heroku run python manage.py migrate

## Notes

### Using a local PostgreSQL database

1. Get a dump of the database
2. Create a local database `createdb okfn`
3. Populate it `psql okfn --file=/path/to/dump.sq` or `pg_restore -d okfn path/to/dump.dump`

Then to run the app use `export DATABASE_URL=postgres://{USER}@localhost/okfn && honcho -f Procfile.dev start`
Prepare the database. This step can be skipped if you'd like to use dummy SQLite database:
- Get a dump of the database
- Create a local database `createdb okfn`
- Populate it `psql okfn --file=/path/to/dump.sq` or `pg_restore -d okfn path/to/dump.dump`

Cherry-pick environment variables from `.env.example` you'd like to set and add it to the `.env` file. Popular options:
- CACHE_URL
- DATABASE_URL
- DJANGO_DEBUG
- DJANGO_SECRET_KEY

Prepare the app:
```bash
pip install -r requirements.dev.txt
npm install
python manage.py migrate
python manage.py update_index
```

Start the server:
```
python manage.py runserver # dev
gunicorn foundation.wsgi:application --access-logfile '-' --error-logfile '-' # prod
```

Another option is to use Docker. For this one you should configure your database to work with remote connections using a proper IP address in the connection string or you should use default SQLite database (omit `DATABASE_URL`):
```
docker build -t okfn .
docker run -d -p 8888:80 -e DATABASE_URL=<change_me> -e <...> okfn
```
100 changes: 0 additions & 100 deletions bin/copyapp

This file was deleted.

35 changes: 0 additions & 35 deletions bin/post_compile

This file was deleted.

23 changes: 23 additions & 0 deletions foundation/organisation/migrations/0011_auto_20180719_1144.py
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('organisation', '0010_networkgroup_forum_group_url'),
]

operations = [
migrations.AlterModelOptions(
name='boardmembership',
options={'ordering': ['-order', 'person__name']},
),
migrations.AddField(
model_name='boardmembership',
name='order',
field=models.IntegerField(help_text=b'Higher numbers mean higher up in the list', null=True, blank=True),
),
]

0 comments on commit c84c7b5

Please sign in to comment.