Skip to content

Commit

Permalink
Merge 659073f into 0b59f0e
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Aug 25, 2014
2 parents 0b59f0e + 659073f commit 02628ef
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 81 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export DJANGO_DEBUG=1
export DATABASE_URL=postgis://bpzaroundme@/bpzaroundme
109 changes: 29 additions & 80 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,112 +52,61 @@ If you are proposing a feature:
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)

.. _get-started:

Get Started!
------------

Ready to contribute? Here's how to set up `BPZAround.me` for local development.

1. Setup a GeoDjango-compatible database. We recommend PostgreSQL 9.1+ with
PostGIS 2.0 or greater. See these links for help:

* `PostGIS Installation Page`_
* `PostgreSQL Download Page`_
* `Installing PostGIS`_ from Django documentation

.. _`PostGIS Installation Page`: http://postgis.net/install
.. _`PostgreSQL Download Page`: http://www.postgresql.org/download/
.. _`Installing PostGIS`: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/postgis

2. Create a template PostgreSQL database with the PostGIS extensions loaded.
This will be used for your development database and for temporary databases
created during tests::

$ createdb template_postgis
$ psql template_postgis -c "CREATE EXTENSION postgis;"
$ psql template_postgis -c "CREATE EXTENSION postgis_topology;"
$ psql template_postgis -c "UPDATE pg_database SET datistemplate=true WHERE datname='template_postgis';"


3. Fork the `BPZAround.me` repo on GitHub.
4. Clone your fork locally::

$ git clone git@github.com:your_name_here/BPZAround.me.git

5. Install your local copy into a virtualenv. Assuming you have
virtualenvwrapper installed, this is how you set up your fork for local
development::
#. `Fork BPZAround.me`_ on GitHub.

$ mkvirtualenv BPZAround.me
$ cd BPZAround.me/
$ pip install -r requirements.txt -r requirements.test.txt -r requirements.dev.txt
#. `Clone`_ your fork locally::

6. Setup your local environment::
git clone git@github.com:your_name_here/BPZAround.me.git

$ vi $VIRTUAL_ENV/bin/postactivate # Add exporting variables
$ vi $VIRTUAL_ENV/bin/postactivate # Unset variables
$ source $VIRTUAL_ENV/bin/postactivate # Apply changes
#. Install requirements into a `virtualenv`_. This is easiest with
`virtualenvwrapper`_::

Here's a suggested postactivate::
mkvirtualenv BPZAround.me
cd BPZAround.me/
pip install -r requirements.txt -r requirements.dev.txt

#!/bin/bash
# This hook is run after this virtualenv is activated.
#. `Install PostGIS for GeoDjango`_.

export DJANGO_DEBUG=1
export DATABASE_URL=postgis://bpzaroundme@/bpzaroundme
#. Create a ``bpzaroundme`` PostGIS spatial database per the
`Post-installation`_ instructions for your version of Postgres & PostGIS.::

And the matching predeactivate::
#. Setup your local environment (Note: you can automate this with `autoenv`_)::

#!/bin/bash
# This hook is run after this virtualenv is activated.
source .env

unset DJANGO_DEBUG
unset DATABASE_URL

See bpzaroundme/settings.py for additional settings.

7. Get your PostGIS database setup::

$ createuser --createdb --login bpzaroundme
$ createdb --owner=bpzaroundme --template=template_postgis bpzaroundme
$ ./manage.py syncdb # Setup your superuser as well

8. Make sure tests work::
#. Make sure tests work::

$ ./manage.py test

9. Run it!::
#. Run it!::

$ ./manage.py runserver

.. _`Fork BPZAround.me`: https://github.com/codefortulsa/BPZAround.me/fork
.. _Clone: http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository#Cloning-an-Existing-Repository
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
.. _virtualenvwrapper: http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation
.. _autoenv: https://github.com/kennethreitz/autoenv
.. _`Install PostGIS for GeoDjango`:
https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/postgis
.. _`Post-installation`: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/postgis/#post-installation

Run on Heroku
-------------

1. Install the prerequisites for Heroku. See
`Getting Started with Django on Heroku`_ for detailed instructions.
Get to the point where you've created your app (after ``heroku create``).

.. _`Getting Started with Django on Heroku`:
https://devcenter.heroku.com/articles/getting-started-with-django

2. Configure your app. Here's a suggested configuration::

$ heroku config
$ heroku config:set DJANGO_DEBUG=1
$ heroku config:set SECURE_PROXY_SSL_HEADER="HTTP_X_FORWARDED_PROTO,https"
$ heroku config:set ALLOWED_HOSTS=*
$ heroku config:set INSTALLED_APPS=gunicorn
$ heroku config:set STATIC_ROOT=staticfiles
$ heroku config:set SECRET_KEY=`python -c "from django.utils.crypto import get_random_string; print(get_random_string())"`

3. Run it::

$ heroku ps:scale web=1
$ heroku ps # Verify
$ heroku open # Open in your browser, or
$ heroku logs # See what went wrong
#. `Register for Heroku`_

#. .. image:: https://www.herokucdn.com/deploy/button.png
:target: https://heroku.com/deploy?template=https://github.com/codefortulsa/BPZAround.me

.. _`Register for Heroku`: https://id.heroku.com/signup

Make Changes
------------
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ BPZAround.me
.. image:: https://coveralls.io/repos/codefortulsa/BPZAround.me/badge.png
:target: https://coveralls.io/r/codefortulsa/BPZAround.me

.. image:: https://www.herokucdn.com/deploy/button.png
:target: https://heroku.com/deploy


BPZAround.me alerts you when someone is building, planning, or zoning around you.

Expand Down
11 changes: 11 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "BPZAround.me",
"description": "BPZAround.me alerts you when someone is building, planning, or zoning around you.",
"repository": "https://github.com/codefortulsa/BPZAround.me",
"keywords": ["python", "django", "geodjango", "postgres", "postgis", "twilio"],
"env": {
"SECRET_KEY": {
"generator": "secret"
}
}
}
5 changes: 4 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
Installation
============

.. note:: These are end-user installation instructions. If you want to
contribute, see :ref:`get-started`

At the command line::

$ easy_install BPZAround.me

Or, if you have virtualenvwrapper installed::

$ mkvirtualenv BPZAround.me
$ pip install BPZAround.me
$ pip install BPZAround.me

0 comments on commit 02628ef

Please sign in to comment.