A boilerplate for Django web applications

Overview

Django Hackathon Starter

A boilerplate application for Django web applications.

If you've attented hackathons, you already know how much time can be wasted figuring out what language to pick, which web framework to choose, which APIs to incorporate, and figuring out OAuth authentication. Django Hackathon Starter aims to provide these features out of the box, allowing the team to save hours of time getting these pieces together.

Even if you are not using this for a hackathon, Django Hackathon Starter is sure to save any developer hours or even days of development time and can serve as a learning guide for web developers.

Basic Authentication / OAuth Signin

Login

API Examples

API Examples

Table of Contents

Features

  • User Registration
  • Sphinx Documentation
  • Django Nosetests
  • Integration with Django Rest Framework
  • Basic Authentication with username and password
  • OAuth 2.0 Authentication
    • Github
    • LinkedIn
    • Instagram
    • Facebook
    • Google+
    • Dropbox
    • Foursquare
  • OAuth 1.0a Authentication
    • Twitter
    • Tumblr
  • API Examples
    • Yelp API
    • Github API
    • Instagram API
    • Tumblr API
    • Twitter API
    • Twilio API
    • Meetup API
    • Steam API
    • Quandl Stock API
    • New York Times API
    • LinkedIn API
    • Facebook API
    • Google+ API
    • Dropbox API
    • Foursquare API

Pre-requisites

This project relies on bower for front-end dependencies, which in turn requires npm. npm is now bundled with NodeJS, which you can download and install here.

For Python-specific libraries, this project relies on pip. The easiest way to install pip can be found here.

Getting Started

To get up and running, simply do the following:

$ git clone https://github.com/DrkSephy/django-hackathon-starter.git
$ cd django-hackathon-starter

# Install the requirements
$ pip install -r requirements.txt

# Install bower
$ npm install -g bower
$ bower install

# Perform database migrations
$ python manage.py makemigrations
$ python manage.py migrate

NOTE: We highly recommend creating a Virtual Environment. Python Virtual Environments allow developers to work in isolated sandboxes and to create separation between python packages installed via pip.


Getting API Keys

  1. Register an account on Yelp.com
  2. Visit the Yelp for developers page
  3. You will obtain the following: CONSUMER KEY, CONSUMER SECRET, TOKEN, TOKEN_SECRET
  4. Within settings.py, add the following:
    • YELP_CONSUMER_KEY = Yelp Consumer Key
    • YELP_CONSUMER_SECRET = Yelp Consumer Secret
    • YELP_TOKEN = Yelp Token
    • YELP_TOKEN_SECRET = Yelp Token Secret

  1. Register an account on Meetup.com
  2. Visit Meetup OAuth Consumers page
    • Enter a project name for the consumer name field
    • For redirect url field, enter: http://127.0.0.1:8000/hackathon/
  3. Within settings.py, add the following:
    • MEETUP_CONSUMER_KEY = Meetup key
    • MEETUP_CONSUMER_SECRET = Meetup secret key

  1. Register an account on Twilio.com
  2. Get your Twilio Number
  3. Setup the numbers you want to be able to send messages to
  4. Grab your account_sid and auth_token here
  5. Within scripts/twilioapi.py:
    • Replace account_sid with your own Twilio account_sid
    • Replace auth_token with your own Twilio auth_token

  1. Register an account on Github.com.
  2. Visit Github developer applications page
  3. Click on Register new application.
    • Enter Application name and Homepage URL field
    • For redirect url field, enter: http://127.0.0.1:8000/hackathon/
  4. Click Register application.
  5. Within settings.py, add the following:
    • GITHUB_CLIENT_ID = Github-client-id
    • GITHUB_CLIENT_SECRET = Github-client-secret

  1. Register an account on Twitter.com
  2. Visit Twitter application management page
  3. Click on Create New App
    • Enter Application name, Description, and Website field
    • For Callback URL field, enter: http://127.0.0.1:8000/hackathon/
  4. Click Create your Twitter application
  5. Go to the Permissions tab
  6. Under Access, select Read and Write type
  7. Go to Keys and Access Tokens tab
  8. Under Your Access Token, click on Create my access token to generate access tokens
  9. Within settings.py, add the following:
    • TWITTER_CONSUMER_KEY = Twitter-consumer-key
    • TWITTER_CONSUMER_SECRET = Twitter-consumer-secret
    • TWITTER_ACCESS_TOKEN = Twitter-access-token
    • TWITTER_ACCESS_TOKEN_SECRET = Twitter-access-token-secret

  1. Register an account on Instagram.com.
  2. Visit Instagram manage clients page
  3. Click on Register a New Client
    • Enter Application name, Description, and Website URL field
    • For Redirect URI field, enter: http://127.0.0.1:8000/hackathon/
  4. Within settings.py, add the following:
    • INSTAGRAM_CLIENT_ID = Instagram-client-id
    • INSTAGRAM_CLIENT_SECRET = Instagram-client-secret

  1. Register an account on Linkedin.com.
  2. Visit Linkedin developer Network page
  3. Click on Add New Application
    • Enter Company Info, Application Info, and Contact Info section
    • Under OAuth User Agreement section, select scopes needed
    • For OAuth 2.0 Redirect URLs field, enter: http://127.0.0.1:8000/hackathon/
  4. Click Add Application
  5. Within settings.py, add the following:
    • LINKEDIN_CLIENT_ID = Linkedin-client-id
    • LINKEDIN_CLIENT_SECRET = Linkedin-client-secret

  1. Register an account on Facebook.com
  2. Visit Facebook Developers page
  3. After logging in, Click on My Apps and then on Add a New App
    • Choose Website as the platform and add the name for your project
    • Give your app a name.
    • Choose the category your app falls into.
    • Click Create App ID
    • Skip the quickstart process and you will be redirected to the app dashboard.
  4. Copy the app ID and the app secret.
  5. From the left menu choose the Settings option.
  6. Click on Add Platform and choose Website once again.
  7. Under site URL, specift the URL to be redirected after authentication is complete.
  8. Click save.
  9. In settings.py change the following values:
    • FACEBOOK_APP_ID = your_app_id
    • FACEBOOK_APP_SECRET = your_app_secret

  1. Register an account on Google.com.
  2. Navigate to Google Developer Console.
  3. Click on Create Project, give your app a name and click Create (this might take a few sceonds).
  4. You will be redirected to the project dashboard. From the left menu choose APIs & auth and then choose APIs.
  5. Choose the API you would like to use (the built in example uses Google+ API).
  6. Click on Enable API.
  7. From the side menu, under APIs & auth select consent screen.
    • Fill your app name under Product Name.
    • Hit save button on the bottom.
  8. From the side menu, under APIs & auth select credentials:
    • Click on Create new Client ID.
    • Under Authorized JavaScript origins specify you app base address (e.g http://localhost:8000).
    • Under Authorized redirect URIs specify the URL to be redirected after authentication is complete.
    • Hit Create Client ID button (this might also take a few seconds).
  9. Copy your new generated client_id and client_secret:
  10. Under settings.py change the following values:
    • GOOGLE_PLUS_APP_ID = your_client_id
    • GOOGLE_PLUS_APP_SECRET = your_client_secret

  1. Register an account on Dropbox.com.
  2. Navigate to Dropbox Developers.
  3. From the side menu, select App Console and click on Create app.
  4. Configure the app permissions. This example uses the following configuration:
    • App type- Dropbox API app
    • My app needs access to files already on Dropbox.
    • My app needs access to a user's full Dropbox.
    • Note: This kind of configuration will require you to submit your app for approval.
  5. Give your app a name and click the Create app button.
  6. You will be redirected to the app console:
    • Under Redirect URIs specify the URL to be redirected after authentication is complete (e.g http://locahost:8000/home) and click add.
    • Copy your App key and App secret.
  7. Under settings.py change the following values:
    • DROPBOX_APP_ID = your_app_id
    • DROPBOX_APP_SECRET = your_app_secret

  1. Register and account on Foursquare.com.
  2. Navigate to Foursquare For Developers.
  3. From the top menu bar select My Apps and you will be redirected to the app dashboard.
  4. Hit Create a New App:
    • Give your app a name.
    • Under Download / welcome page url, specify your app main url (e.g http://www.localhost:8000).
    • Under Redirect URI, specify the URL to be redirected after authentication is complete (e.g http://locahost:8000/home) and click add.
    • Scroll all the way to the botttom and hit Save Changes.
  5. From the App page you were redirected to, copy your App key and App secret.
  6. Under settings.py change to following values:
    • FOURSQUARE_APP_ID = your_client_id
    • FOURSQUARE_APP_SECRET = your_app_secret

  1. Register an account on Tumblr.com.
  2. Visit Tumblr applications page.
  3. Click on Register Application.
  4. Click Register.
  5. Within settings.py, add the following:
    • TUMBLR_CONSUMER_KEY = Tumblr-consumer-key
    • TUMBLR_CONSUMER_SECRET = Tumblr-consumer-secret

  1. Register an account on Steam
  2. Visit Steam Community developers page
  3. After logging in, add the Domain Name as the name of your application and key is shown
  4. Within your views.py add the Key in key underneath the view for your steam application

  1. Register an account on NY Times Developer Network
  2. Click on Register
  3. After logging in, click on APIs (http://developer.nytimes.com/apps/register) Write in the Name of your application and click each sub-API that you will use
    • Agree to the Terms of Service and click on Register Application
  4. Within your settings.py add the following:
    • POPAPIKEY = Most Popular API
    • TOPAPIKEY = Top Stories API

  1. Register an account on Quandl
  2. After logging in, click on Me and then Account settings to find the API key
  3. Within your settings.pyadd QUANDLAPIKEY = Key

Project Structure

Name Description
hackathon_starter/settings.py Django settings module containing database and API keys/tokens
hackathon/admin.py Registered models for Django's admin page
hackathon/models.py Django models and profiles for user login
hackathon/tests.py Integration tests
hackathon/urls.py Django Hackathon Starter URL dispatcher
hackathon/views.py Django views file
hackathon/serializers.py Allows JSON representation for Django Model fields
hackathon/forms.py Basic form fields
hackathon/static/ Front-end JavaScript / CSS files
hackathon/unittests Unit tests
hackathon/scripts/ API Example scripts
**hackathon/scripts/**github.py Script for interacting with Github API
**hackathon/scripts/**instagram.py Script for interacting with Instagram API
**hackathon/scripts/**linkedin.py Script for interacting with LinkedIn API
**hackathon/scripts/**meetup.py Script for interacting with Meetup API
**hackathon/scripts/**nytimes.py Script for interacting with New York Times API
**hackathon/scripts/**quandl.py Script for interacting with Quandl API
**hackathon/scripts/**scraper.py Basic web scraper for getting sales from Steam
**hackathon/scripts/**facebook.py Script for interacting with Facebook API
**hackathon/scripts/**dropbox.py Script for interacting with Dropbox API
**hackathon/scripts/**foursquare.py Script for interacting with Foursquare API
**hackathon/scripts/**googlePlus.py Script for interacting with Google+ API
**hackathon/scripts/**steam.py Script for interacting with Steam API
**hackathon/scripts/**tumblr.py Script for interacting with Tumblr API
**hackathon/scripts/**twilioapi.py Script for interacting with Twilio API
**hackathon/scripts/**twitter.py Script for interacting with Twitter API
**hackathon/scripts/**yelp.py Script for interacting with Yelp API
**hackathon/templates/**hackathon/ Templates for API examples
**hackathon/templates/**hackathon/base.html Base template, contains navbar

Contributing

We welcome contributions of all kinds. If you would like to know what work is needed to be done, check the issue tracker. Before sending a pull request, please open an issue. This project follows the pep-0008 style guide.

LICENSE

The MIT License (MIT)

Copyright (c) 2015 David Leonard

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Owner
David Leonard
Engineering @DataDog. Previously JavaScript Ninja @Clarifai & @yahoo.
David Leonard
Creating Templates and components so those can be reusable some time and makes workflow a lot easier!

TEMPLATES AND COMPONENTS IN ANY LANG! This is an Open Repository For Students to Contribute code in Hackoctoberfest in different Languages and Tech me

SriSravyaN 9 Feb 19, 2022
Get a Django app up and running in dev, test, and production with best practices in 10 minutes

Django template for Docker + Heroku This is how I set up Django projects to get up and running as quick as possible. In includes a few neat things: De

Ben Firshman 30 Oct 13, 2022
A Django starter template with a sound foundation.

SOS Django Template SOS Django Tempalate is a Django starter template that has opinionated and good solutions while starting your new Django project.

Eray Erdin 19 Oct 30, 2022
Django sample app with users including social auth via Django-AllAuth

demo-allauth-bootstrap Simple, out-of-the-box Django all-auth demo app A "brochure" or visitor (no login required) area A members-only (login required

Andrew E 215 Dec 20, 2022
A Django project skeleton that is modern and cutting edge.

{% comment "This comment section will be deleted in the generated project" %} Edge A Fantastic Django project starter. Features Ready Bootstrap-themed

Arun Ravindran 827 Dec 15, 2022
Launchr is an open source SaaS starter kit, based on Django.

Launchr Launchr is an open source SaaS starter kit. About Launchr is a fully-equipped starter template, ready to start a SaaS web app. It implements t

Jannis Gebauer 183 Jan 06, 2023
A template repo for use in the Advent of Code

AoC-Template A template repo for use in the Advent of Code The README_template.md must contain "STATS_TABLE" to be replaced by the generated table, an

0 Jan 14, 2022
A boilerplate for Django web applications

Django Hackathon Starter A boilerplate application for Django web applications. If you've attented hackathons, you already know how much time can be w

David Leonard 1.6k Dec 31, 2022
simple flask starter app utilizing docker

Simple flask starter app utilizing docker to showcase seasonal anime using jikanpy (myanimelist unofficial api).

Kennedy Ngugi Mwaura 5 Dec 15, 2021
The starter repository for submissions to the GeneDisco challenge for optimized experimental design in genetic perturbation experiments

GeneDisco ICLR-22 Challenge Starter Repository The starter repository for submissions to the GeneDisco challenge for optimized experimental design in

22 Dec 06, 2022
A full stack boilerplate for FastAPI

A full stack boilerplate for FastAPI

Tyler M. Kontra 94 Dec 13, 2022
King is a simple boilerplate from a bigger Discord Bot project created for my Discord Server.

King A simple Discord bot boilerplate. King is a simple boilerplate from a bigger Discord Bot project created for my Discord Server. I intend to showc

Xminent 0 Aug 21, 2021
Vue + Django with no compromises. Django Templates and Vue SFCs in harmony without sacrificing the full power of either.

Cookiecutter Vue Django Vue + Django with no compromise. Cookiecutter Vue Django is a framework for jumpstarting production-ready Django + Vue project

Mike Hoolehan 122 Dec 22, 2022
Bleeding edge django template focused on code quality and security.

wemake-django-template Bleeding edge django2.2 template focused on code quality and security. Purpose This project is used to scaffold a django projec

wemake.services 1.6k Jan 04, 2023
A project to get you started with Docker and Django.

Docker Django tl;dr $ git clone [email protected]:erroneousboat/docker-django.git $ d

JP Bruins Slot 176 Dec 29, 2022
A test Django application with production-level docker setup

DockerApp A test Django application with production-level docker setup. Blog: https://medium.com/@siddharth.sahu/the-near-perfect-dockerfile-for-djang

Siddharth Sahu 44 Nov 18, 2022
Ultimate Django3.2 Template for starting any project from not zero!

Ultimate Django3.2 Template for starting any project from not zero!

TheAliBigdeli 37 Dec 20, 2022
Cookiecutter to create a Google Function. Powered by Poetry, GitHub actions, and Google Cloud Platform

Cookiecutter Google Function Cookiecutter template for a Google Function. Powered by Poetry, and GitHub actions. Quickstart Install the latest Cookiec

Arthur 1 Jan 07, 2022
Django Webpack starter template for using Webpack 5 with Django 3.1 & Bootstrap 4. Yes, it can hot-reload.

Django Webpack Starter Hello fellow human. The repo uses Python 3.9.* Django 3.1.* Webpack 5.4.* Bootstrap 4.5.* Pipenv If you have any questions twe

Ganesh Khade 56 Nov 28, 2022
Generic template for python service

Cookie cutter template example Technology stack Flask Gevent UWSGI Poetry Docker Docker-compose Installation pip install cookiecutter cookiecutter git

Churkin Oleg 11 Oct 22, 2022