Always Sunrise is a Django web app that determines where a sunrise is occuring and plays the closest livestream to that location. It can be found at always-sunrise.com.
pip install -r requirements.txt
.env
file and add this API key as follows (no ""
surround your key):
GOOGLE_MAPS_API_KEY=<your_key>
Admins input a list of livestream links from around the world. When a livestream object is created, two API calls are made:
These are then saved to the database.
When a user visits the site, the server decides which livestream to show. This is determined by two factors:
Because sunrise times change everyday, a daily call is made to the SunriseSunset API to update all livestreams' sunrise times. This occurs at 1:19am (UTC).
Always Sunrise is hosted by PythonAnywhere. To run commands on the PythonAnywhere server you will need to open a Bash console in the virtual environment. To do so, in the PythonAnywhere dashboard, go to "Web apps" and click on "Start a console in this virtualenv".
• Retrieve sunrise times and add them to your objects:
python manage.py sync_livestreams
• Run Black (python formatter):
black alwayssunriseapp ./*.py --exclude migrations