Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
Cleaned up settings
Browse files Browse the repository at this point in the history
- Removed unneeded settings
- Restored logging
- Cleaned up some imports
  • Loading branch information
clintonb committed Jan 28, 2019
1 parent 47dd509 commit 15ba3bb
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 237 deletions.
4 changes: 0 additions & 4 deletions showCrime/dailyIncid/templates/dailyIncid/getQuery.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@
<p><h3>Related resources</h3>
<ul>
<li><a href="http://static.electronicartifacts.com/OPD_beatMap.jpg">OPD beat map</a>
<p>
<li><a href="http://mapgis.oaklandnet.com/PoliceDistricts/">OPD District & Beat Locator</a>
</ul>
<hr>
<p>
<p align=center>{{siteUrl}}</p>

{% endblock %}
46 changes: 13 additions & 33 deletions showCrime/dailyIncid/views.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
# django 2.0
# from django.core.urlresolvers import reverse
from django.urls import reverse

from django.db.models import Min, Max, Q
from django.db.models.lookups import IExact
# from django.db import transaction
# from django.db import IntegrityError
from django.template import Context

from django.contrib.gis.geos import Polygon
# from django.contrib import admin
# from django.contrib.gis.admin import GeoModelAdmin
from django.contrib.gis.measure import D

from rest_framework import generics # viewsets

# from datetime import datetime, timedelta

import logging
import pytz
import random

import geojson

from showCrime.settings import PLOT_PATH, SITE_URL
import geojson
import pytz
from django.conf import settings
from django.contrib.gis.geos import Polygon
from django.contrib.gis.measure import D
from django.db.models import Max, Min, Q
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from rest_framework import generics

from dailyIncid import serializers
from .forms import *
from .models import *
from dailyIncid import serializers


def awareDT(naiveDT):
utc=pytz.UTC
Expand Down Expand Up @@ -72,9 +57,8 @@ def getQuery(request):
logger.info('user=%s getQuery-nonPost' % (userName))
qform = twoTypeQ()

return render(request, 'dailyIncid/getQuery.html', {'form': qform, 'siteUrl': SITE_URL})
return render(request, 'dailyIncid/getQuery.html', {'form': qform})

import os

import matplotlib

Expand All @@ -86,8 +70,6 @@ def getQuery(request):
import pylab as p

from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.dates import DateFormatter
from datetime import datetime,timedelta,date
import matplotlib.dates as mdates

Expand Down Expand Up @@ -270,7 +252,7 @@ def plotResults(request,beat,crimeCat,crimeCat2=None):
f1.autofmt_xdate()

figDPI=200
fullPath = PLOT_PATH+fname+'_'+runTime+'.png'
fullPath = settings.PLOT_PATH+fname+'_'+runTime+'.png'
logger.info('user=%s plotting %d/%d (%6.2f sec) to %s' % (userName,totBeat,totCity,qryTime.total_seconds(),fullPath))

# 2do: 181218 fix plot file permission
Expand Down Expand Up @@ -298,9 +280,7 @@ def otherUtil(request):

## GeoDjango

from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.geos import Point
from django.contrib.gis.utils import LayerMapping


@login_required
Expand Down
Loading

0 comments on commit 15ba3bb

Please sign in to comment.