随笔分类 -  Django

python 学习
摘要:查询方法一般有: 阅读全文
posted @ 2016-05-16 09:55 gopher-lin 阅读(206) 评论(0) 推荐(0)
摘要:tail /var/log/apache2/error.log ssh root@114.215.93.125 scp r /Users/Fiz/Documents/blog root@114.215.93.125:/home/ CREATE DATABASE Blog DEFAULT CHARAC 阅读全文
posted @ 2016-02-23 14:00 gopher-lin 阅读(107) 评论(0) 推荐(0)
摘要:1 安装 apache2 和 mod_wsgi sudo apt get install apache2 http://www.ziqiangxuetang.com/django/django deploy.html 阅读全文
posted @ 2016-02-20 21:25 gopher-lin 阅读(129) 评论(0) 推荐(0)
摘要:UnicodeEncodeError at /admin/home/article/add/ 'ascii' codec can't encode characters in position 3 6: ordinal not in range(128) import sys reload(sy... 阅读全文
posted @ 2016-01-20 11:26 gopher-lin 阅读(130) 评论(0) 推荐(0)
摘要:首先创建环境 安装pip3 install virtualenv 然后virtualenv env source env/bin/activate 在这一步可能出现setupptools无法安装的错误 测选择 virtualenv env no setuptools 这样就可以创建成功 让... 阅读全文
posted @ 2015-12-31 11:24 gopher-lin 阅读(315) 评论(0) 推荐(0)
摘要:import sys reload(sys) sys.setdefaultencoding('utf 8') 阅读全文
posted @ 2015-12-30 17:42 gopher-lin 阅读(130) 评论(0) 推荐(0)
摘要:abstract 这个属性是定义当前的模型类是不是一个抽象类。所谓抽象类是不会对应数据库表的。一般我们用它来归纳一些公共属性字段,然后继承它的子类可以继承这些字段。比如下面的代码中Human是一个抽象类,Employee是一个继承了Human的子类,那么在运行syncdb命令时,不会生成Huma... 阅读全文
posted @ 2015-12-30 17:27 gopher-lin 阅读(163) 评论(0) 推荐(0)
摘要:http://segmentfault.com/n/1330000003944169 pip install upgrade six scrapy conda install f lxml No module named easy_install pyOpenssl一直报错是版本的问题,安装0... 阅读全文
posted @ 2015-12-13 20:05 gopher-lin 阅读(163) 评论(0) 推荐(0)
摘要:result_sensorData = SensorData.objects.filter(sensor_id=1, sensor_type='SOIL_TEMP_SENSOR').values('sensorData')[0]['sensorData'] 调试程序暂时1号传感器的采集数据温度数据 阅读全文
posted @ 2015-11-22 19:23 gopher-lin 阅读(583) 评论(0) 推荐(0)
摘要:table=$(' tab') for (var i = 0; i < 5; i++) { var tr = $("<tr </tr "); tr.appendTo(table); for (var j = 0; j < 11; j++) { var td = $("<td " + i j + "<... 阅读全文
posted @ 2015-11-11 17:06 gopher-lin 阅读(168) 评论(0) 推荐(0)
摘要:<!DOCTYPE <html <head <meta http equiv="Content Type" content="text/html; charset=gb2312" <title 动态创建表格</title <script type="text/javascript" src="htt... 阅读全文
posted @ 2015-11-11 16:31 gopher-lin 阅读(323) 评论(0) 推荐(0)
摘要:尝试Notebook, 还需要下载一些其它咚咚 1) 下载安装 pyzmq, 在这里不建议使用pip, pip对pyzmq支持不太好,装不上。我尝试使用easy_install c: easy_install.exe pyzmq 2) 下载安装 jinja2, c: easy_install.e... 阅读全文
posted @ 2015-11-04 12:46 gopher-lin 阅读(140) 评论(0) 推荐(0)
摘要:使用Form 表单提交的时候,切件是用render ,替代render_to_reponse 阅读全文
posted @ 2015-11-03 21:56 gopher-lin 阅读(132) 评论(0) 推荐(0)
摘要:要放在clic之后才能获取到值,不然有点问题,获取的值是空的 阅读全文
posted @ 2015-10-31 18:47 gopher-lin 阅读(138) 评论(0) 推荐(0)
摘要:{% extends 'base.html' %}{% block title %}报表{% endblock title %}{% block extracss %} <style type="text/css" btn { background: F4A460; } </style {% en... 阅读全文
posted @ 2015-10-31 10:20 gopher-lin 阅读(270) 评论(0) 推荐(0)
摘要:coding:utf 8 from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response from django.shortcuts import r... 阅读全文
posted @ 2015-10-31 10:17 gopher-lin 阅读(658) 评论(0) 推荐(0)
摘要:def excel_ajax(request): response = HttpResponse() response['Content Disposition'] = 'attachment;filename=export_agencycustomer.xls' wb = xlwt.Work... 阅读全文
posted @ 2015-10-30 00:25 gopher-lin 阅读(235) 评论(0) 推荐(0)
摘要:前台:用DOJO发送AJAX请求,设定返回值为json格式。var deferred = dojo.xhrPost({ url: "/test_json/", handleAs: "json", load: function(response, ioArgs){ return respons... 阅读全文
posted @ 2015-10-29 13:34 gopher-lin 阅读(160) 评论(0) 推荐(0)
摘要:from django.core.serializers.json import DjangoJSONEncoder List = {'my_time': test, 'guang': 2 } return HttpResponse(json.dumps(List, cl... 阅读全文
posted @ 2015-10-29 13:31 gopher-lin 阅读(162) 评论(0) 推荐(0)
摘要:import datetime,timestringDate = "2006-05-18 19:35:00"dt = datetime.datetime.fromtimestamp(time.mktime(time.strptime(stringDate,"%Y-%m-%d %H:%M:%S")))... 阅读全文
posted @ 2015-10-29 08:59 gopher-lin 阅读(1982) 评论(0) 推荐(0)