Skip to content

Commit

Permalink
First release of TwittMap
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajinkya Shukla committed Oct 27, 2016
1 parent 455fbf1 commit 029b525
Show file tree
Hide file tree
Showing 48 changed files with 1,338 additions and 0 deletions.
3 changes: 3 additions & 0 deletions TwittMap/.ebextensions/django.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: TwittMap/wsgi.py
12 changes: 12 additions & 0 deletions TwittMap/.elasticbeanstalk/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
branch-defaults:
default:
environment: TwittMap-dev
global:
application_name: TwittMap
branch: null
default_ec2_keyname: aws-eb
default_platform: Python 3.4
default_region: us-west-2
profile: null
repository: null
sc: null
5 changes: 5 additions & 0 deletions TwittMap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
Expand Down
18 changes: 18 additions & 0 deletions TwittMap/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TwittMap</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
<nature>org.python.pydev.django.djangoNature</nature>
</natures>
</projectDescription>
14 changes: 14 additions & 0 deletions TwittMap/.pydevproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
<key>DJANGO_MANAGE_LOCATION</key>
<value>manage.py</value>
<key>DJANGO_SETTINGS_MODULE</key>
<value>TwittMap.settings</value>
</pydev_variables_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/${PROJECT_DIR_NAME}</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.0</pydev_property>
</pydev_project>
Empty file added TwittMap/TwittMap/__init__.py
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added TwittMap/TwittMap/__pycache__/urls.cpython-35.pyc
Binary file not shown.
Binary file added TwittMap/TwittMap/__pycache__/wsgi.cpython-35.pyc
Binary file not shown.
121 changes: 121 additions & 0 deletions TwittMap/TwittMap/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
"""
Django settings for TwittMap project.
Generated by 'django-admin startproject' using Django 1.10.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'p4xf4-bri@+glh2==jxx-@0tvrcu&u630%(y&&zc+p@bnhthsa'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main'
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'TwittMap.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'TwittMap.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/

STATIC_URL = '/static/'
23 changes: 23 additions & 0 deletions TwittMap/TwittMap/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""TwittMap URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from main import views

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^marker/', views.render_markermap)
]
16 changes: 16 additions & 0 deletions TwittMap/TwittMap/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for TwittMap project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TwittMap.settings")

application = get_wsgi_application()
Binary file added TwittMap/__pycache__/twitter.cpython-35.pyc
Binary file not shown.
Binary file added TwittMap/db.sqlite3
Binary file not shown.
Empty file added TwittMap/main/__init__.py
Empty file.
Binary file added TwittMap/main/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
Binary file added TwittMap/main/__pycache__/admin.cpython-35.pyc
Binary file not shown.
Binary file added TwittMap/main/__pycache__/models.cpython-35.pyc
Binary file not shown.
Binary file added TwittMap/main/__pycache__/tests.cpython-35.pyc
Binary file not shown.
Binary file added TwittMap/main/__pycache__/views.cpython-35.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions TwittMap/main/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions TwittMap/main/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class MainConfig(AppConfig):
name = 'main'
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions TwittMap/main/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
56 changes: 56 additions & 0 deletions TwittMap/main/templates/main/heatmap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<style>
html, body, #map {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<script>
var map;

function initialize() {
var mapOptions = {
zoom: 2,
center: {lat: -33.865427, lng: 151.196123},
mapTypeId: 'terrain'
};

map = new google.maps.Map(document.getElementById('map'),
mapOptions);

// Create a <script> tag and set the USGS URL as the source.
var script = document.createElement('script');

// (In this example we use a locally stored copy instead.)
// script.src = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.geojsonp';
script.src = 'https://developers.google.com/maps/documentation/javascript/tutorials/js/earthquake_GeoJSONP.js';
document.getElementsByTagName('head')[0].appendChild(script);

}

function eqfeed_callback(results) {
var heatmapData = [];
for (var i = 0; i < results.features.length; i++) {
var coords = results.features[i].geometry.coordinates;
var latLng = new google.maps.LatLng(coords[1], coords[0]);
heatmapData.push(latLng);
}
var heatmap = new google.maps.visualization.HeatmapLayer({
data: heatmapData,
dissipating: false,
map: map
});
}

</script>
</head>
<body>
<div id="map"></div>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDe8zGf9ncvsDxND35AGbq7HTxcZVfxdmo&libraries=visualization&callback=initialize">
</script>
</body>
</html>
85 changes: 85 additions & 0 deletions TwittMap/main/templates/main/marker.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
width: 100%;
height: 100%;
background-color: grey;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="#">Twitt Map</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<form class="navbar-form navbar-left" role="search" id="keywordsForm" action="">
<div class="form-group">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Select Keyword
<span class="caret"></span>
</button>
<input type="hidden" name="keyword" id="keyword" />
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li onclick="$('#keyword').val('trump');$('#keywordsForm').submit()"><a href="#">Trump</a></li>
<li onclick="$('#keyword').val('hillary');$('#keywordsForm').submit()"><a href="#">Hillary</a></li>
<li onclick="$('#keyword').val('clinton');$('#keywordsForm').submit()"><a href="#">Clinton</a></li>
<li onclick="$('#keyword').val('election');$('#keywordsForm').submit()"><a href="#">Election</a></li>
<li onclick="$('#keyword').val('new');$('#keywordsForm').submit()"><a href="#">New</a></li>
<li onclick="$('#keyword').val('york');$('#keywordsForm').submit()"><a href="#">York</a></li>
<li onclick="$('#keyword').val('united');$('#keywordsForm').submit()"><a href="#">United</a></li>
<li onclick="$('#keyword').val('states');$('#keywordsForm').submit()"><a href="#">States</a></li>
<li onclick="$('#keyword').val('and');$('#keywordsForm').submit()"><a href="#">And</a></li>
<li onclick="$('#keyword').val('from');$('#keywordsForm').submit()"><a href="#">From</a></li>
</ul>
</div>
</div>
</form>
</li>
<li>
<div class="alert alert-info" role="alert">
<strong>
Found {{ hits }} hits
</strong>
</div>
</li>
</div>
</div><!-- /.container-fluid -->
</nav>
<div id="map"></div>
<script>

function initMap() {
var uluru = {{ data }};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: {lat: 40.7128 ,lng: -74.0059}
});
for(var i=0;i<uluru.length;i++)
var marker = new google.maps.Marker({
position: uluru[i],
map: map
});
}

</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDe8zGf9ncvsDxND35AGbq7HTxcZVfxdmo&callback=initMap">
</script>
</body>
</html>
3 changes: 3 additions & 0 deletions TwittMap/main/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
Loading

0 comments on commit 029b525

Please sign in to comment.