OpenStay uses the hackathon boilerplate https://github.com/DrkSephy/django-hackathon-starter
- User Registration
- Sphinx Documentation
- Django Nosetests
- Integration with Django Rest Framework
- Basic Authentication with username and password
- OAuth 2.0 Authentication
- Google+
- OAuth 1.0a Authentication
- API Examples
- Twitter API
- Facebook API
- Google+ API
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.
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
$ manage.py runserver localhost:8080
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.
- Register an account on Twitter.com
- Visit Twitter application management page
- Click on Create New App
- Enter
Application name
,Description
, andWebsite
field - For
Callback URL
field, enter:http://127.0.0.1:8000/hackathon/
- Enter
- Click Create your Twitter application
- Go to the Permissions tab
- Under Access, select Read and Write type
- Go to Keys and Access Tokens tab
- Under Your Access Token, click on Create my access token to generate access tokens
- 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
- Register an account on Facebook.com
- Visit Facebook Developers page
- 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.
- Copy the app ID and the app secret.
- From the left menu choose the Settings option.
- Click on Add Platform and choose Website once again.
- Under site URL, specift the URL to be redirected after authentication is complete.
- Click save.
- In
settings.py
change the following values:FACEBOOK_APP_ID = your_app_id
FACEBOOK_APP_SECRET = your_app_secret
- Register an account on Google.com.
- Navigate to Google Developer Console.
- Click on Create Project, give your app a name and click Create (this might take a few sceonds).
- You will be redirected to the project dashboard. From the left menu choose APIs & auth and then choose APIs.
- Choose the API you would like to use (the built in example uses Google+ API).
- Click on Enable API.
- From the side menu, under APIs & auth select consent screen.
- Fill your app name under Product Name.
- Hit save button on the bottom.
- 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).
- Copy your new generated
client_id
andclient_secret
: - Under
settings.py
change the following values:GOOGLE_PLUS_APP_ID = your_client_id
GOOGLE_PLUS_APP_SECRET = your_client_secret
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/**facebook.py | Script for interacting with Facebook API |
**hackathon/scripts/**googlePlus.py | Script for interacting with Google+ API |
**hackathon/scripts/**twitter.py | Script for interacting with Twitter API |
**hackathon/templates/**hackathon/ | Templates for API examples |
**hackathon/templates/**hackathon/base.html | Base template, contains navbar |
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.
Where applicable to hackathon code contribution the MIT license is applied otherwise OpenStay is housed under the Mozilla Public License Version 2.0
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.