Skip to content

Commit 9327302

Browse files
committed
Add initial Vagrantfile
This is the beginning of putting together a Vagrant box for people who would like to contribute to nycpython.com. The Vagrantfile (via bootstrap.sh) installs all of the dependencies. The README is being updated to reflect this change in setup. It's also being changed from Markdown to reStructuredText. Why? Because Python. Flask-SQLAlchemy is being removed as a dependency for the time being because we aren't yet using a database. Once it's placed back, SQLAlchemy, psycopg2, and PostgreSQL will need to be added as well, with Postgres being handled by Vagrant.
1 parent a4f4a75 commit 9327302

File tree

6 files changed

+143
-126
lines changed

6 files changed

+143
-126
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# The test db
1010
dev.db
1111

12+
# Vagrant
13+
.vagrant
14+
1215
# Github's default python gitignore
1316
*.py[cod]
1417

README.md

Lines changed: 0 additions & 124 deletions
This file was deleted.

README.rst

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
nycpython.com
2+
=============
3+
4+
The official website of the NYC Python meetup group.
5+
6+
Technologies
7+
++++++++++++
8+
9+
We will be using the following technologies
10+
11+
- `Python 3`_
12+
- Flask_, a microframework
13+
- Jinja2_, a template engine
14+
15+
.. _Flask: http://flask.pocoo.org/docs/
16+
.. _Jinja2: http://jinja.pocoo.org/docs/
17+
.. _Python 3: http://docs.python.org/3/
18+
19+
Getting Started
20+
+++++++++++++++
21+
22+
Here's everything you need to know to get a copy of nycpython.com running
23+
locally.
24+
25+
What You Need
26+
-------------
27+
28+
- Git_
29+
- `A GitHub account`_
30+
- `The code`_
31+
- VirtualBox_
32+
- Vagrant_ (`docs <http://docs.vagrantup.com/v2/>`_)
33+
34+
.. _Git: http://git-scm.com/downloads
35+
.. _A GitHub account: https://github.com
36+
.. _The code: https://github.com/NYCPython/nycpython.com
37+
.. _Vagrant: http://downloads.vagrantup.com/
38+
.. _VirtualBox: https://www.virtualbox.org/wiki/Downloads
39+
40+
Setup
41+
-----
42+
43+
After installing VirtualBox and Vagrant, `fork the code on GitHub`_ and clone it
44+
locally by executing the following command, replacing ``USERNAME`` with your
45+
GitHub username::
46+
47+
$ git clone [email protected]:USERNAME/nycpython.com.git
48+
49+
After doing that, execute the following command to build your local virtual
50+
machine::
51+
52+
$ vagrant up
53+
54+
You can access all of your code locally, but you will need the virtual machine
55+
to access the server. To access the virtual machine's command line interface,
56+
execute the following command::
57+
58+
$ vagrant ssh
59+
60+
To run the nycpython.com server, execute the following commands on the virtual
61+
machine::
62+
63+
$ workon nycpythoncom
64+
$ python src/server.py
65+
66+
The site can be accessed in your browser by visiting `localhost:5050`_.
67+
68+
.. _fork the code on GitHub: https://github.com/NYCPython/nycpython.com/fork
69+
.. _localhost:5050: http://localhost:5050
70+
71+
Meetup API
72+
----------
73+
74+
In order to work with the `Meetup API`_, you will first need to create a `Meetup
75+
API Key`_.
76+
77+
.. _Meetup API: http://www.meetup.com/meetup_api/
78+
.. _Meetup API Key: http://www.meetup.com/meetup_api/key/
79+
80+
Twitter API
81+
-----------
82+
83+
In order to work with the `Twitter API`_, you will first need to create a
84+
`Twitter Application`_. Once you have created the application, you will be able
85+
to retrieve its OAuth settings.
86+
87+
.. _Twitter API: https://dev.twitter.com/docs/api/1.1
88+
.. _Twitter Application: https://dev.twitter.com/apps/new
89+
90+
Contributing
91+
++++++++++++
92+
93+
A list of issues can be found on GitHub_. Issues are categorized as graphics
94+
(e.g., logos, banners), front-end (e.g., HTML, CSS, JavaScript), and back-end
95+
(e.g., Python, API Integration).
96+
97+
Pick one and start hacking away!
98+
99+
.. _GitHub: https://github.com/NYCPython/nycpython.com/issues
100+

Vagrantfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
config.vm.box = "precise64"
9+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
10+
11+
config.vm.provision :shell, :path => "bootstrap.sh"
12+
13+
config.vm.network :forwarded_port, host: 5050, guest: 5000
14+
end

bootstrap.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
apt-get update > /dev/null
4+
apt-get install -y python-software-properties
5+
add-apt-repository ppa:fkrull/deadsnakes
6+
apt-get update > /dev/null
7+
apt-get install -y emacs git-core nano python3.3-dev python-pip vim
8+
9+
# Upgrade Pip before installing anything with it.
10+
sudo pip install -U pip
11+
sudo pip install -U virtualenvwrapper
12+
13+
# Make virtualenvwrapper available to vagrant
14+
echo "source /usr/local/bin/virtualenvwrapper.sh" >> /home/vagrant/.bashrc
15+
16+
# Set up a virtualenv. Make sure to use vagrant's home, otherwise it will be
17+
# created in /root.
18+
export WORKON_HOME=/home/vagrant/.virtualenvs
19+
mkdir $WORKON_HOME
20+
source /usr/local/bin/virtualenvwrapper.sh
21+
mkvirtualenv -p /usr/bin/python3.3 -a /vagrant nycpythoncom
22+
workon nycpythoncom
23+
24+
# Install the requirements. Without the `--pre` flag Pip would see pytz's
25+
# releases as pre-release versions and fail.
26+
pip install --upgrade --pre --requirement /vagrant/requirements.txt

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
Flask==0.10.1
22
git+git://github.com/jonafato/Flask-LazyViews.git
3-
Flask-SQLAlchemy==0.16
43
Jinja2==2.7
54
MarkupSafe==0.18
65
Pygments==1.6
7-
SQLAlchemy==0.8.1
86
Werkzeug==0.9.1
97
itsdangerous==0.21
108
requests==1.2.3

0 commit comments

Comments
 (0)