内容正在载入中,请稍后……
公告
搜索
统计
其他
分页: 2/6 第一页 上页 1 2 3 4 5 6 下页 最后页 [ 显示模式: 摘要 | 列表 ]
15 Feb.2012

django-admin.py遇到的几点问题 不指定

作者: 我就是个世界   分类:技术&学习 » Django   出处:本站原创   
django官方turial中创建本地web站点时,使用如下命令
django-admin.py startproject mysite


说一下我在使用时碰到的几个问题:

1、无法找到django-admin.py文件?

解决:django在安装完后,正常会将C:\Python25\Lib\site-packages\django\bin路径添加到path环境变量中,因而可以直接运行django-admin.py。但是,我正常安装完后并没有自动添加到环境变量,因此需要手动添加进去。
13 Nov.2011
While I was learning how to use django-registration app, I discover in the tutorial that I need to know how to send an email for the user to activate the registration.
我找到了这个指南,教我学习如何去使用 django-registration app,如何为用户发送电子邮件,以激活注册。
Thanks to folk at the Django chatroom, they advice me to google 'django gmail' and I discover a post at nathanostgard.com that show roughly how to do it. Here I'm going to extend a little on how to test it using shell.

1. Create a project, 创建一个项目
3 Nov.2011

django-imagekit ImageKit 1.0.1中文文档翻译 夜晚

作者: 我就是个世界   分类:技术&学习 » Django   出处:本站原创   
django-imagekit介绍
Automates image processing for Django models. Resize, process and cache multiple versions of your image files. Access newly created files with a standard API. Supports alternate storage schemes such as Amazon S3.
自动化图像处理为Django模型。为你的图像文件调整大小,处理和缓存为多个版本。使用一个标准的API访问新创建的文件。支持云存储方案,如Amazon S3。

准备用这个东西,国内没搜索到相关的文档,所以自己翻译了一份。E文水平有限,有不到之处,请见凉!
-----------------------------
原英文文档 ImageKit 1.0.1 documentation

Getting Started  快速入门

ImageKit is a Django app that helps you to add variations of uploaded images to your models. These variations are called “specs” and can include things like different sizes (e.g. thumbnails) and black and white versions.
ImageKit是一个Django应用程序,可以帮助你添加上传图像变化到你的模型。这些变形称为“specs”,可以包括诸如不同尺寸(例如缩略图)和黑白的版本。
6 Oct.2011
今天在用django写了个图片上传测试APP的时候,上传图片就报错如下:

SuspiciousOperation at /admin/photos/photo/1/
Attempted access to '\upload\201110\2011-09-151302830075_m.jpg' denied.
时间:18:13 评论(0) 引用(0) 阅读(3586) Tags: , ,
1 Oct.2011

Django 使用内置分页模块分页的简单实现 晴

作者: 我就是个世界   分类:技术&学习 » Django   出处:本站原创   
Django分页比较简单,它内置了一个Paginator类.这样对分页的操作只需要明白这个类就OK了。
时间:06:37 评论(0) 引用(0) 阅读(4827) Tags: ,
1 Oct.2011
我的一个Model里有个FileField字段,用来存储文件路径,但是发现1.3版在django admin里面删除model的时候,存储在硬盘上的文件没有一起删除

我查找官方文档,似乎这个功能是在1.3版后改变了(似乎这个活儿django不管了,覆写的delete()方法不会被调用了)。

我的代码:
时间:02:28 评论(0) 引用(0) 阅读(4212) Tags:
24 Sep.2011

使用django来获取用户访问的IP地址 晴

作者: 我就是个世界   分类:技术&学习 » Django   出处:本站原创   
使用django来获取用户访问的IP地址,如果用户是正常情况下,未使用代理访问,则
request.META['REMOTE_ADDR']


可以获得用户的IP地址。但是有些网站服务器会使用ngix等代理http,或者是该网站做了负载均衡,导致使用remote_addr抓取到的是1270.0.1,这时使用HTTP_X_FORWARDED_FOR才获得是用户的真实IP。推荐使用以下代码:
时间:16:55 评论(0) 引用(0) 阅读(5185) Tags: ,
分页: 2/6 第一页 上页 1 2 3 4 5 6 下页 最后页 [ 显示模式: 摘要 | 列表 ]