This is a set of instructions to setup a Django Nginx Gunicorn MySQL/Postgres stack on a single Amazon EC2 instance.
from tastypie.exceptions import NotFound | |
from tastypie.resources import ModelResource | |
from tastypie.authentication import BasicAuthentication, ApiKeyAuthentication | |
from tastypie.models import ApiKey | |
from django.contrib.auth.models import User | |
__author__ = 'martinsandstrom' | |
class ApiTokenResource(ModelResource): |
def nearby_spots_old(request, lat, lng, radius=5000, limit=50): | |
""" | |
WITHOUT use of any external library, using raw MySQL and Haversine Formula | |
http://en.wikipedia.org/wiki/Haversine_formula | |
""" | |
radius = float(radius) / 1000.0 | |
query = """SELECT id, (6367*acos(cos(radians(%2f)) | |
*cos(radians(latitude))*cos(radians(longitude)-radians(%2f)) | |
+sin(radians(%2f))*sin(radians(latitude)))) |
git log --since='last month' --pretty=format:'%h;%an;%ad;%s' --author='Ionut Colceriu' > ~/log.csv |
This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).
Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.
Switch to the master branch and make sure you are up to date:
We need to generate a unique SSH key for our second GitHub account.
ssh-keygen -t rsa -C "your-email-address"
Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY
. In my case, I've saved the file to ~/.ssh/id_rsa_work
.
I started a project on a Hobby Dev plan (free, limit 10,000 rows), and then later needed to upgrade it to Hobby Basic ($9/month, limit 10,000,000 rows).
After assigning the new database, I had two databases attached to the application. They looked something like this:
- HEROKU_POSTGRESQL_OLIVE (postgresql-dimensional-3321) Old, free-tier (Hobby Dev) database