Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses Python 2 for now. Python 3 supported via an Ansible variable. (See README for details)
- Loading branch information
Showing
17 changed files
with
147 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
example: true # TODO, put any common variables in here | ||
virtualenv: ~/virtualenvs/pythonkc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
--- | ||
user: pythonkc | ||
pythonpath: /TODO | ||
project_root: /TODO/pythonkc_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
--- | ||
user: vagrant | ||
pythonpath: /home/vagrant/vagrant | ||
project_root: /home/vagrant/vagrant/pythonkc_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
python_version: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
- name: Create virtualenvs directory | ||
file: dest=~/virtualenvs state=directory owner={{ user }} group={{ user }} | ||
|
||
|
||
- name: Install requirements into Python 2.7 virtualenv | ||
pip: | ||
requirements: "{{ project_root }}/requirements/project.txt" | ||
virtualenv: "{{ virtualenv }}" | ||
virtualenv_command: /usr/bin/virtualenv -p python2.7 | ||
when: python_version == 2 | ||
|
||
|
||
- name: Install requirements into Python 3 virtualenv | ||
pip: | ||
requirements: "{{ project_root }}/requirements/project.txt" | ||
virtualenv: "{{ virtualenv }}" | ||
virtualenv_command: python3 /usr/lib/python3/dist-packages/virtualenv.py -p python3 | ||
when: python_version == 3 | ||
|
||
|
||
- name: Set some env vars when activating virtualenv | ||
lineinfile: | ||
dest: "{{ virtualenv }}/bin/activate" | ||
regexp: "^export {{ item.name }}=" | ||
line: "export {{ item.name }}={{ item.value }}" | ||
state: present | ||
insertafter: EOF | ||
with_items: | ||
- {name: DJANGO_SETTINGS_MODULE, value: pythonkc_site.settings} | ||
- {name: PYTHONPATH, value: "{{ pythonpath }}"} | ||
|
||
|
||
- name: Automatically activate the virtualenv in bashrc | ||
lineinfile: | ||
dest: ~/.bashrc | ||
line: "source {{ virtualenv }}/bin/activate" | ||
state: present | ||
insertafter: EOF | ||
|
||
|
||
- name: Run migrations | ||
django_manage: | ||
command: migrate | ||
app_path: "{{ project_root }}" | ||
pythonpath: "{{ pythonpath }}" | ||
virtualenv: "{{ virtualenv }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- {include: python2.yml, tags: python, when: python_version == 2} | ||
- {include: python3.yml, tags: python, when: python_version == 3} | ||
- include: tools.yml tags=tools | ||
- include: django.yml tags=django | ||
|
||
# TODO | ||
# vim + vim configuration for python? | ||
# postgres? (for now just using sqlite for development) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Update apt | ||
apt: update_cache=yes cache_valid_time=3600 | ||
become: yes | ||
tags: apt | ||
|
||
- name: Install some base packages | ||
apt: pkg="{{item}}" state=latest | ||
become: yes | ||
tags: apt | ||
with_items: | ||
- build-essential | ||
- libpq-dev | ||
- python-dev | ||
- python-pip | ||
- python-software-properties | ||
- python-virtualenv |
9 changes: 4 additions & 5 deletions
9
ansible/roles/base/tasks/main.yml → ansible/roles/pythonkc/tasks/python3.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
--- | ||
- name: Update apt | ||
apt: update_cache=yes cache_valid_time=3600 | ||
become: yes | ||
tags: apt | ||
|
||
- name: Install some base packages | ||
apt: pkg="{{item}}" state=latest | ||
become: yes | ||
tags: apt | ||
with_items: | ||
- build-essential | ||
- libpq-dev | ||
- python3 | ||
- python3-dev | ||
- python3-pip | ||
- python3-software-properties | ||
- vim-nox | ||
- htop | ||
|
||
# What else should go in here? | ||
# vim + vim configuration for python? | ||
- python3-virtualenv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- name: Update apt | ||
apt: update_cache=yes cache_valid_time=3600 | ||
become: yes | ||
tags: apt | ||
|
||
|
||
- name: Install some dev tools packages | ||
apt: pkg="{{item}}" state=latest | ||
become: yes | ||
tags: apt | ||
with_items: | ||
- vim-nox | ||
- htop | ||
|
||
# TODO basic vimrc with python plugins? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
--- | ||
- hosts: vagrant | ||
sudo: yes | ||
|
||
# you can have tasks right here | ||
tasks: | ||
- name: Say hello | ||
shell: echo `date` > /home/vagrant/hello.txt | ||
|
||
# and you can have 'roles' | ||
roles: | ||
- role: base | ||
tags: base_role | ||
- pythonkc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
export MEETUP_API_KEY='your-meetup-api-key-here' | ||
export DJANGO_SECRET_KEY='django-secret-key-here' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
gondor==1.0.5 | ||
wsgiref==0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
Django==1.8.3 | ||
django-dotenv==1.3.0 | ||
django-redis-cache==0.9.2 | ||
gondor==1.0.5 | ||
mimeparse==0.1.3 | ||
psycopg2==2.6.1 | ||
python-dateutil==1.5 | ||
pythonkc-meetups==0.1.0 | ||
redis==2.10.3 | ||
requests==2.7.0 | ||
wsgiref==0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters