Skip to content

Instantly share code, notes, and snippets.

View fchevitarese's full-sized avatar

Frederico Rodrigues Chevitarese fchevitarese

  • Vila Velha
  • 09:13 (UTC -03:00)
View GitHub Profile
@fchevitarese
fchevitarese / untitled
Created August 13, 2015 14:21
error.log
File "/home/fred/.virtualenvs/datagoal/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 141, in get_user_model
raise ImproperlyConfigured("AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL)
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'user.User' that has not been installed
@fchevitarese
fchevitarese / models.py
Created August 13, 2015 14:05
models.py
# coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from django.db import models
from django.utils.html import format_html
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from user.models import User
@fchevitarese
fchevitarese / __init__.py
Created August 13, 2015 14:05
__init__.py
from __future__ import absolute_import
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
@fchevitarese
fchevitarese / celery.py
Created August 13, 2015 14:04
celery.py
from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'datagoal.settings')
from django.conf import settings
celery -A datagoal worker -l info
Traceback (most recent call last):
File "/home/fred/.virtualenvs/datagoal/bin/celery", line 11, in <module>
sys.exit(main())
File "/home/fred/.virtualenvs/datagoal/local/lib/python2.7/site-packages/celery/__main__.py", line 30, in main
main()
File "/home/fred/.virtualenvs/datagoal/local/lib/python2.7/site-packages/celery/bin/celery.py", line 81, in main
cmd.execute_from_commandline(argv)
File "/home/fred/.virtualenvs/datagoal/local/lib/python2.7/site-packages/celery/bin/celery.py", line 769, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
$promise: undefined
$resolved: true
class_name: "Value"
datadoc: Object
22: "29/07/2015"
__proto__: Object
harvest: 167
id: 1293
question: 80
data.forEach(function (harvest) {
var values = harvest.values,
h = new Harvest();
h.id = harvest.id;
h.uuid = harvest.uuid;
h.device = harvest.device;
h.date = harvest.created;
h.values = [];
for q in data['values']:
q['question'] = Question.objects.get(id=q['question'])
q['harvest'] = harvest
hv, created = Value.objects.update_or_create(harvest=q['harvest'],
question_id=q['question'].pk)
hv.harvest = q['harvest']
hv.question = q['question']
# print(q['datadoc'])
# coding:utf-8
# from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.core.mail import send_mail, BadHeaderError
@csrf_exempt
def contact_me(request):
name = request.POST.get('name', '')
var app = angular.module('myApp', ['ngGrid', 'ngResource']);
app.config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
}]);