Git Product home page Git Product logo

fast-food-friday's Introduction

fast-food-friday

R&D project combining AngularJS, Django Tastypie and Trigger.io

Every Friday at JPCreative we have a tradition of eating lunch together, sometimes forming a consensus on what to have proves difficult. Until now... Introducing the Fast Fast Friday app.

It's a simple proof on concept app for iOS and Android that allows users to sign in via twitter, suggest and vote for their preferred lunch menu. It's coded completely in Python, HTML, CSS and JavaScript. No native code is used at all.

The back end creates a API using Django and Tastypie. The front-end communicates to the API through AngularJS wrapped up into a native app by trigger.io

Installation

To package iOS apps with trigger.io you'll need OSX with Xcode. I'd also suggest you install Xcode command line tools. To package Android apps will you need to install Java and the android SDK.

Django

You'll need pip and virtualenvwrapper:

$ sudo easy_install pip
$ pip install virtualenvwrapper

Setup your environment and Django app:

$ mkvirtualenv authAppEnv
(authAppEnv)$ pip install -r requirements.txt
(authAppEnv)$ cd authApp
(authAppEnv)$ python manage.py syncdb
(authAppEnv)$ sudo python manage.py runserver YOUR-IP-HERE:80

The reason for using sudo and your IP with runserver will become clear when getting angular running locally.

Visit https://dev.twitter.com/apps to create a Twitter app and get a consumer and secret key. Set the Callback URL to http://YOUR-IP-HERE/logged-in. In your browser go to: http://YOUR-IP-HERE/admin/socialaccount/socialapp/add/ and create a social app. Sign out of Django admin, visit http://YOUR-IP-HERE/accounts/login/ and sign in with Twitter. Hopefully that will prompt Twitter to authorize your account and redirect you to the login screen 'YAY'. Please take a note of the URL query string as we'll need that for testing Angular.

Angular.js

Open trigger/src/static/angular/services.js in your IDE of choice, and edit the line:

var apiCall = $resource('http://YOUR-IP-HERE/api/v1/:type/:id',

Add your IP but don't add :80 or Angular will think it's another parameter and ignore the colon.

We also need to update SiginInCtrl() with your IP, username, api_key and user id (saved from the query string in last step of installing Django)

controllers.js:

...
theURL = 'http://YOUR-IP-HERE/auth/?username=YOUR-TWITTER-USERNAME&api_key=YOUR-API-KEY&user=2';
...
url: 'http://YOUR-IP-HERE/accounts/twitter/login/',
pattern: 'http://YOUR-IP-HERE/auth/*'
...

To get the app running locally:

$ cd trigger/src
$ python -m SimpleHTTPServer

Visit http://0.0.0.0:8000 in a web browser or iOS/Android simulator.

Trigger.io

Visit trigger.io and follow the steps to get up and running. Create a new app and copy over the contents of trigger/src to the new trigger app src folder. Edit the app config to include 'tabs'.

Run the app.

fast-food-friday's People

Contributors

robjpc avatar jpcreative avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.