Skip to content

pyconca/pycon-2015

Repository files navigation

Pycon Canada 2015

Development Environment Setup

You will need the following:

Start by creating a python virtual environment:

$ npm install
$ mkvirtualenv pycon --python=/usr/local/bin/python3
(pycon) $

The (pycon) prefix indicates that a virtual environment called "pycon" is being used. Next, check that you have the correct version of Python:

(pycon) $ python --version
Python 3.4.3
(pycon) $ pip --version
pip 7.1.1 from /Users/..../site-packages (python 3.4)

Install the project requirements:

(pycon) $ pip install --upgrade -r requirements.txt

Create the database:

(pycon) $ python manage.py migrate

Create pycon/localsettings.py with the following

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
DEBUG = True
TEMPLATE_DEBUG = True

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'dev_db.sqlite3'),
    }
}

Run the project:

(pycon) $ python manage.py runserver

Less Styles Compilation

Gulp is used to watch and autorun less compilation:

$ gulp

Translation Files

Translation files are stored in /locale. To create these files, you must have gettext installed.

$ django-admin makemessages -l fr

To update translation files from the code for all languages:

$ django-admin makemessages -a

To edit translation files, open the .po file for the correct language and edit the msgstr lines.

After creating or updating translation files, you must compile them into .mo files:

$ django-admin compilemessages

Deploying

Setup

Ensure the following is in your ~/.ssh/config:

Host pycon-ca
    HostName 72.51.30.16
    User deploy

Install less:

$ sudo -i npm install -g less

Obtain a copy of private.yml and put it in deploy/vars.

Deploying to Stage or Prod

Go to the deploy directory and run:

$ ansible-playbook -i inventory/prod site.yml

Importing Feedback URLs

Sign up at (Bitly)[https://bitly.com/a/sign_in?rd=%2Fa%2Foauth_apps] and get auth token.

Add BITLY_KEY = 'YOUR_TOKEN_HERE' to your localsettings.py file.

Import the URLs:

$ python manage.py importfeedbackurls

Building the Static Cache on the Server

$ cd /data/web/2015.pycon.ca/pyconca/
$ . ../activate
$ python manage.py staticsitegen