Sunsetter is a simple python web app running on Heroku that can calculate, given a point of view and a point of interest (selected on a google map) on which day of the year the sun will rise or set in this direction.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
static
templates
.gitignore
CakeFile
Procfile
Procfile.dev
README.markdown
app.py
package.json
requirements.in
requirements.txt
sunazymuth.py
sunsetter.sublime-project

README.markdown

What is this?

Sunsetter is a simple python web app running on Heroku that can calculate, given a point of view and a point of interest (selected on a google map) on which day of the year the sun will rise or set in this direction. More info on my blog.

It is based on the brilliant pysolar library for the hardcore astronomical calculations. It also uses spin.js for a cool Ajax spinner without any GIF.

Note: the app is configured to predict when the sun's lower limb touches the horizon, not the civil sunset when the sun completely disappears behind the horizon, as this makes for a better picture. This setting can be modified app-wide in sunazymuth.py.

How to run it on my machine?

If you want to download it and run it on your own machine you must first install venv in the same folder and activate it:

virtualenv venv --distribute
source venv/bin/activate

This should change your prompt to include a (venv) prefix. Then install the pre-requirements with this command:

pip install -r requirements.txt

Finally you need to add one environment variable to plug to local memcached without auth. Add the following to a .env file in the root folder:

DEVELOPMENT=TRUE

And variables for API Keys:

ANALYTICS=UA-XXXXXX-1
MAPS_API=123456789qwertyuiop

You can then run locally with foreman start -f Procfile.dev which will start the python app as well as memcached and a coffee compiler to compile any changes to the javascript on the fly. Connect to the app in your browser on http://localhost:5000