diff options
author | luxagraf <sng@luxagraf.net> | 2013-09-10 18:00:02 +0000 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2013-09-10 18:00:02 +0000 |
commit | 1bd92fd5abc212434cf8f41bb90ded3bf3795849 (patch) | |
tree | 13f56b442c1fe88a413e9aaf3a5eb8ff24eb5f5e | |
parent | 4a1ae16f4446807960ec367a2c8afebf6175304e (diff) |
migrated to gunicorn, fixed elements broken in move to digital ocean and rebuilt the link gathering script
-rw-r--r-- | README | 25 | ||||
-rw-r--r-- | app/builder/base.py | 6 | ||||
-rw-r--r-- | app/cron/sync_links.py | 18 | ||||
-rw-r--r-- | app/cron/sync_photos.py | 17 | ||||
-rw-r--r-- | app/links/retriever.py | 2 | ||||
-rw-r--r-- | config/gunicorn_config.py | 9 | ||||
-rw-r--r-- | config/settings/settings.py | 21 | ||||
-rw-r--r-- | config/settings/settings_dev.py | 12 | ||||
-rw-r--r-- | config/wsgi.py (renamed from config/config.wsgi) | 0 | ||||
-rw-r--r-- | design/templates/archives/homepage.html | 2 | ||||
-rw-r--r-- | design/templates/archives/map.html | 6 | ||||
-rw-r--r-- | design/templates/archives/writing.html | 2 | ||||
-rw-r--r-- | design/templates/base.html | 4 | ||||
-rw-r--r-- | design/templates/details/national-parks.html | 6 | ||||
-rw-r--r-- | site/media/js/natparks.js | 2 | ||||
-rw-r--r-- | site/media/js/natparks.min.js | 13 |
16 files changed, 94 insertions, 51 deletions
@@ -1,3 +1,27 @@ +TODO: + +[] Look into multimarkdown support along with preprocessor for addin srcset to image tags +[] Experiement with pagespeed optionsa +[] figure out memchached +[] Install PHP for Adatptive images +[] Switch Gunicorn to run as nobody -- didn't work, causing internal error +[] Write out geojson data for natparks into site/projects/natparks/parkid +[] Redo template on natparks page to call new location +[] Update view fuction to add project name (for now just hard code it) +[] Build out page with all links, filter through them +[] Port Flickr code an add some image compression +[] Add support for srcset to handle high res screens +[] Use Adaptive Images to handle older posts +[] Make full build button work +[] build out entry aside model +[] Add JavaScript to dynamically build asides. maybe. +[] Create css for large image pages light and dark (should just need structural css, dark class name could be enough to work for large image dark pages. + +--- +Older Notes and ToDos + + + Currently caught in the middle between static_generator and build Static generator is cleaner, but much of the build code is hard to port. Keep going back and rorth and so far neither works save for building the feed. @@ -9,7 +33,6 @@ What I should do is refactor both into a single clean module with methods for bu * All Photo -- done * All Projects --done * All Pages (about, contact, etc) -- done - * Links # Everything needed to post a new entry... * writing archives * map diff --git a/app/builder/base.py b/app/builder/base.py index 6e99003..d626505 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -207,14 +207,12 @@ class BuildProjects(Build): included_fields=['id',], geom_attribute='mpoly', mimetype = 'application/json', - pretty_print=True ) json = str(json) json ="\n".join(json.splitlines()[3:]) #print json - path = 'projects/data/' - fpath = '%s%s.json' %(path, park.id) - self.write_file(fpath,json) + path = 'projects/data/natparks/' + self.write_file(path, json, 'json', park.id) class BuildSitemap(Build): def build(self): diff --git a/app/cron/sync_links.py b/app/cron/sync_links.py index 4bec6d2..cd1373d 100644 --- a/app/cron/sync_links.py +++ b/app/cron/sync_links.py @@ -1,13 +1,13 @@ import sys, os from os.path import dirname, abspath - -PROJECT_ROOT = abspath(dirname(dirname(__file__))) - +PROJECT_ROOT = abspath(dirname(dirname(dirname(__file__))))+'/' +#PROJECT_ROOT = abspath(dirname(dirname(__file__))) +print PROJECT_ROOT sys.path.append(PROJECT_ROOT) -sys.path.append(PROJECT_ROOT+'/apps') -sys.path.append(PROJECT_ROOT+'/lib') -sys.path.append(PROJECT_ROOT+'/lib/utils') -sys.path.append('/home/luxagraf/webapps/django/lib/python2.7/') -os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' +sys.path.append(PROJECT_ROOT+'/app') +sys.path.append(PROJECT_ROOT+'/app/lib') +sys.path.append(PROJECT_ROOT+'/config') +sys.path.append('/home/luxagraf/apps/venv/bin/python2.7/') +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.settings' from links import retriever -retriever.sync_pinboard_links()
\ No newline at end of file +retriever.sync_pinboard_links() diff --git a/app/cron/sync_photos.py b/app/cron/sync_photos.py index 3dc7552..ff601e6 100644 --- a/app/cron/sync_photos.py +++ b/app/cron/sync_photos.py @@ -1,15 +1,12 @@ import sys, os from os.path import dirname, abspath - -PROJECT_ROOT = abspath(dirname(dirname(__file__))) - - +PROJECT_ROOT = abspath(dirname(dirname(dirname(__file__))))+'/' sys.path.append(PROJECT_ROOT) -sys.path.append(PROJECT_ROOT+'/apps') -sys.path.append(PROJECT_ROOT+'/lib') -sys.path.append(PROJECT_ROOT+'/lib/utils') -sys.path.append('/home/luxagraf/webapps/django1_3/lib/python2.7/') -os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' +sys.path.append(PROJECT_ROOT+'/app') +sys.path.append(PROJECT_ROOT+'/app/lib/utils') +sys.path.append(PROJECT_ROOT+'/config') +sys.path.append('/home/luxagraf/apps/venv/bin/python2.7/') +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.settings' from photos import retriever -retriever.sync_flickr_photos()
\ No newline at end of file +retriever.sync_flickr_photos() diff --git a/app/links/retriever.py b/app/links/retriever.py index f876405..bcbc8fa 100644 --- a/app/links/retriever.py +++ b/app/links/retriever.py @@ -108,4 +108,4 @@ def send_to_delicious(link): del_tags += tag.strip().replace(' ','_')+' ' delicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASS, link.url, link.title, tags = del_tags, extended = striptags(link.description), dt =safestr(link.pub_date), replace="no") -'''
\ No newline at end of file +''' diff --git a/config/gunicorn_config.py b/config/gunicorn_config.py new file mode 100644 index 0000000..d918946 --- /dev/null +++ b/config/gunicorn_config.py @@ -0,0 +1,9 @@ +from os.path import dirname, abspath,join +PROJ_ROOT = abspath(dirname(dirname(dirname(__file__))))+'/' +command = join(PROJ_ROOT, "/venv/bin/gunicorn") +pythonpath = PROJ_ROOT +bind = '127.0.0.1:8001' +workers = 3 +log_level = "warning" +error_logfile = "/home/luxagraf/logs/origin.gunicorn.error.log" + diff --git a/config/settings/settings.py b/config/settings/settings.py index 13bcb5e..2c85374 100644 --- a/config/settings/settings.py +++ b/config/settings/settings.py @@ -17,7 +17,7 @@ DATABASES = { 'NAME': 'luxagraf', 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'USER': 'luxagraf', - 'PASSWORD': '32d0fa8b', + 'PASSWORD': 'translinguis#', } } @@ -30,6 +30,14 @@ USE_I18N = False USE_L10N = True USE_TZ = False +# Host for sending e-mail. +EMAIL_USE_TLS = True +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_HOST_USER = 'sendluxagraf@gmail.com' +EMAIL_HOST_PASSWORD = '^C9XZz55UJ@j2@5XNU' +EMAIL_PORT = 587 + + #API key for Google Maps in Admin MAP_API = "google" GOOGLE_MAPS_API_KEY = MAP_API_KEY = 'ABQIAAAAEZ0Oz7LFDmdS1OBHm6HLgRQT5Lr-mnFT_29u-YVgAYs_K_u6-BQ627CkPKq44oaHpmSt2497hDj_LQ' @@ -37,6 +45,9 @@ GOOGLE_MAPS_API_KEY = MAP_API_KEY = 'ABQIAAAAEZ0Oz7LFDmdS1OBHm6HLgRQT5Lr-mnFT_29 # API key for Flickr imports FLICKR_API_KEY = '7b9d978a440c6ab65a545adc0aa0d693' FLICKR_USER_ID = '85322932@N00' +#Pinboard User Info +PIN_USER = "luxagraf" +PIN_PASS = "translinguis" #root url BASE_URL = "http://luxagraf.net/" #path to the folder that holds the generated html files @@ -113,7 +124,12 @@ TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.tz", "django.contrib.messages.context_processors.messages" ) - +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', + 'LOCATION': '127.0.0.1:11211', + } +} ROOT_URLCONF = 'config.base_urls' TEMPLATE_DIRS = ( @@ -143,7 +159,6 @@ INSTALLED_APPS = ( 'projects', 'guide', 'pages' - ) diff --git a/config/settings/settings_dev.py b/config/settings/settings_dev.py index 3cf51d7..a9d5ec8 100644 --- a/config/settings/settings_dev.py +++ b/config/settings/settings_dev.py @@ -32,6 +32,18 @@ USE_I18N = False USE_L10N = True USE_TZ = False + +# Host for sending e-mail. +EMAIL_USE_TLS = True +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_HOST_USER = 'sendluxagraf@gmail.com' +EMAIL_HOST_PASSWORD = '^C9XZz55UJ@j2@5XNU' +EMAIL_PORT = 587 + +EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend' + + + #API key for Google Maps in Admin MAP_API = "google" GOOGLE_MAPS_API_KEY = MAP_API_KEY = 'ABQIAAAAEZ0Oz7LFDmdS1OBHm6HLgRQT5Lr-mnFT_29u-YVgAYs_K_u6-BQ627CkPKq44oaHpmSt2497hDj_LQ' diff --git a/config/config.wsgi b/config/wsgi.py index ab5f23a..ab5f23a 100644 --- a/config/config.wsgi +++ b/config/wsgi.py diff --git a/design/templates/archives/homepage.html b/design/templates/archives/homepage.html index bda8c33..692b21c 100644 --- a/design/templates/archives/homepage.html +++ b/design/templates/archives/homepage.html @@ -39,4 +39,4 @@ {% endfor %} </section> {% endblock %} -{% block js %}<script async src="{{MEDIA_URL}}js/hyphenate.min.js" type="text/javascript"></script>{% endblock%} +{% block js %}<script async src="/media/js/hyphenate.min.js" type="text/javascript"></script>{% endblock%} diff --git a/design/templates/archives/map.html b/design/templates/archives/map.html index 05df67c..5b495af 100644 --- a/design/templates/archives/map.html +++ b/design/templates/archives/map.html @@ -64,8 +64,8 @@ Google Maps code </section> {% endblock %} {% block js %} -<script type="text/javascript" src="{{MEDIA_URL}}js/leaflet-providers.js"></script> -<!--<script type="text/javascript" src="{{MEDIA_URL}}js/mainmap.js"></script>--> -<script type="text/javascript" src="{{MEDIA_URL}}js/mainmap.min.js"></script> +<script type="text/javascript" src="/media/js/leaflet-providers.js"></script> +<!--<script type="text/javascript" src="/media/js/mainmap.js"></script>--> +<script type="text/javascript" src="/media/js/mainmap.min.js"></script> {% endblock%} diff --git a/design/templates/archives/writing.html b/design/templates/archives/writing.html index e704998..dc8ea66 100644 --- a/design/templates/archives/writing.html +++ b/design/templates/archives/writing.html @@ -35,4 +35,4 @@ -{% block js %}<script src="{{MEDIA_URL}}js/hyphenate.min.js" type="text/javascript"></script>{% endblock%} +{% block js %}<script src="/media/js/hyphenate.min.js" type="text/javascript"></script>{% endblock%} diff --git a/design/templates/base.html b/design/templates/base.html index 8c9cd87..a7c757b 100644 --- a/design/templates/base.html +++ b/design/templates/base.html @@ -15,11 +15,11 @@ title="Luxagraf RSS feed" href="http://luxagraf.net/rss/"> {%block stylesheet%}<link rel="stylesheet" - href="{{MEDIA_URL}}css/stylesv6.css" + href="/media/css/stylesv6.css" media="screen">{%endblock%} <!--[if IE]> <link rel="stylesheet" - href="{{MEDIA_URL}}css/ie.css" + href="/media/css/ie.css" media="screen"> <![endif]--> {%block extrahead%}{%endblock%} diff --git a/design/templates/details/national-parks.html b/design/templates/details/national-parks.html index dc3f7fb..8c90f84 100644 --- a/design/templates/details/national-parks.html +++ b/design/templates/details/national-parks.html @@ -45,9 +45,9 @@ </section> {% endblock %} {% block js %} - <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.js"></script> - <script type="text/javascript" src="{{MEDIA_URL}}js/underscore-min.js"></script> - <script type="text/javascript" src="{{MEDIA_URL}}js/natparks.min.js" ></script> + <script type="text/javascript" src="/media/js/jquery.js"></script> + <script type="text/javascript" src="/media/js/underscore-min.js"></script> + <script type="text/javascript" src="/media/js/natparks.min.js" ></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> {% endblock %} diff --git a/site/media/js/natparks.js b/site/media/js/natparks.js index ae69ecd..4b1d4c9 100644 --- a/site/media/js/natparks.js +++ b/site/media/js/natparks.js @@ -14,7 +14,7 @@ function mapit(lat,lon,zoom,id) { map = new google.maps.Map(document.getElementById('map-wrapper-'+id), mapOptions); //get the geojson for this map $.ajax({ - url: "/projects/data/"+id+".json", + url: "/projects/data/natparks/"+id+".json", dataType: "json", success: function(data, text, request) { draw_poly(data); } //complete: function(xhr, status) {console.log(status); return false; }, diff --git a/site/media/js/natparks.min.js b/site/media/js/natparks.min.js index 67e23b6..d077806 100644 --- a/site/media/js/natparks.min.js +++ b/site/media/js/natparks.min.js @@ -1,12 +1 @@ -function mapit(lat,lon,zoom,id){var map;var centerCoord=new google.maps.LatLng(lat,lon);var mapOptions={zoom:zoom,center:centerCoord,mapTypeId:google.maps.MapTypeId.TERRAIN,disableDefaultUI:true,navigationControl:true,navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}};map=new google.maps.Map(document.getElementById('map-wrapper-'+id),mapOptions);$.ajax({url:"/projects/data/"+id+".json",dataType:"json",success:function(data,text,request){draw_poly(data);}});function draw_poly(data){var poly=createPolygons(data.features[0].geometry);for(i=0;i<=poly.length-1;i++){poly[i].setMap(map);}}} -function create_map(obj){var lat=parseFloat(obj.title.split(',')[0]);var lon=parseFloat(obj.title.split(',')[1]);var zoom=parseInt(obj.title.split(',')[2]);var id=obj.title.split(',')[3];$(obj).parents().eq(3).append('<div class="map-container" id="map-container-'+id+'">');$('#map-container-'+id).append('<div class="map-wrapper" id="map-wrapper-'+id+'">');mapit(lat,lon,zoom,id);} -function remove_map(id){$(id).remove();} -function createPolygons(areajson,bounds){var coords=areajson.coordinates;var polygons=_(coords).reduce([],function(memo_n,n){var polygonpaths=_(n).reduce(new google.maps.MVCArray(),function(memo_o,o){var polygoncords=_(o).reduce(new google.maps.MVCArray(),function(memo_p,p){var mylatlng=new google.maps.LatLng(p[1],p[0]);if(bounds){bounds.extend(mylatlng);} -memo_p.push(mylatlng);return memo_p;});memo_o.push(polygoncords);return memo_o;});var polygon=new google.maps.Polygon({paths:polygonpaths,strokeColor:"#201a11",strokeOpacity:0.8,strokeWeight:2,fillColor:"#201a11",fillOpacity:0.35});memo_n.push(polygon);return memo_n;});return polygons;} -function get_exif(obj,id){$(obj).parents().eq(3).append('<div class="more-container" id="'+id+'">');$(obj).parents().eq(2).children('.meta').clone().appendTo('#'+id).css('visibility','visible');$('#exif-container').css({bottom:function(index,value){return parseFloat($(obj).parent().parent().css("height"))-14;}});} -function remove_exif(id){$('#'+id).remove();} -$(document).ready(function(){$('.map-link').click(function(){var more_id='more-container-'+$(this).parent().next().children('.more-link').attr('id').split('-')[1];var id='#map-container-'+this.title.split(',')[3];if($('#'+more_id).is(":visible")){remove_exif(more_id);} -if($(id).is(":visible")){remove_map(id);}else{create_map(this);} -return false;});$('.more-link').click(function(){var map_id='#map-container-'+$(this).parent().prev().children('.map-link').attr('title').split(',')[3];var id='more-container-'+this.id.split('-')[1];if($(map_id).is(":visible")){remove_map(map_id);} -if($('#'+id).is(":visible")){remove_exif(id);}else{get_exif(this,id);} -return false;});});
\ No newline at end of file +function mapit(lat,lon,zoom,id){var map;var centerCoord=new google.maps.LatLng(lat,lon);var mapOptions={zoom:zoom,center:centerCoord,mapTypeId:google.maps.MapTypeId.TERRAIN,disableDefaultUI:true,navigationControl:true,navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}};map=new google.maps.Map(document.getElementById('map-wrapper-'+id),mapOptions);$.ajax({url:"/projects/data/natparks/"+id+".json",dataType:"json",success:function(data,text,request){draw_poly(data)}});function draw_poly(data){var poly=createPolygons(data.features[0].geometry);for(i=0;i<=poly.length-1;i++){poly[i].setMap(map)}}}function create_map(obj){var lat=parseFloat(obj.title.split(',')[0]);var lon=parseFloat(obj.title.split(',')[1]);var zoom=parseInt(obj.title.split(',')[2]);var id=obj.title.split(',')[3];$(obj).parents().eq(3).append('<div class="map-container" id="map-container-'+id+'">');$('#map-container-'+id).append('<div class="map-wrapper" id="map-wrapper-'+id+'">');mapit(lat,lon,zoom,id)}function remove_map(id){$(id).remove()}function createPolygons(areajson,bounds){var coords=areajson.coordinates;var polygons=_(coords).reduce([],function(memo_n,n){var polygonpaths=_(n).reduce(new google.maps.MVCArray(),function(memo_o,o){var polygoncords=_(o).reduce(new google.maps.MVCArray(),function(memo_p,p){var mylatlng=new google.maps.LatLng(p[1],p[0]);if(bounds){bounds.extend(mylatlng)}memo_p.push(mylatlng);return memo_p});memo_o.push(polygoncords);return memo_o});var polygon=new google.maps.Polygon({paths:polygonpaths,strokeColor:"#201a11",strokeOpacity:0.8,strokeWeight:2,fillColor:"#201a11",fillOpacity:0.35});memo_n.push(polygon);return memo_n});return polygons}function get_exif(obj,id){$(obj).parents().eq(3).append('<div class="more-container" id="'+id+'">');$(obj).parents().eq(2).children('.meta').clone().appendTo('#'+id).css('visibility','visible');$('#exif-container').css({bottom:function(index,value){return parseFloat($(obj).parent().parent().css("height"))-14}})}function remove_exif(id){$('#'+id).remove()}$(document).ready(function(){$('.map-link').click(function(){var more_id='more-container-'+$(this).parent().next().children('.more-link').attr('id').split('-')[1];var id='#map-container-'+this.title.split(',')[3];if($('#'+more_id).is(":visible")){remove_exif(more_id)}if($(id).is(":visible")){remove_map(id)}else{create_map(this)}return false});$('.more-link').click(function(){var map_id='#map-container-'+$(this).parent().prev().children('.map-link').attr('title').split(',')[3];var id='more-container-'+this.id.split('-')[1];if($(map_id).is(":visible")){remove_map(map_id)}if($('#'+id).is(":visible")){remove_exif(id)}else{get_exif(this,id)}return false})});
\ No newline at end of file |