小编Han*_*ank的帖子

如何让div点击?

<div><span>shanghai</span><span>male</span></div>
Run Code Online (Sandbox Code Playgroud)

对于像上面这样的div,当鼠标开启时,它应该变成光标:指针,当点击时,触发一个

javascript函数,该怎么做?

编辑:以及如何在鼠标开启时更改div的背景颜色?

编辑再次:如何使第一个跨度的宽度= 120px?似乎不能在Firefox中工作

html javascript css click

28
推荐指数
5
解决办法
19万
查看次数

SQLAlchemy无法找到类名

简化,我有以下类结构(在单个文件中):

Base = declarative_base()

class Item(Base):
    __tablename__ = 'item'
    id = Column(BigInteger, primary_key=True)
    # ... skip other attrs ...

 class Auction(Base):
     __tablename__ = 'auction'
     id = Column(BigInteger, primary_key=True)
     # ... skipped ...
     item_id = Column('item', BigInteger, ForeignKey('item.id'))

     item = relationship('Item', backref='auctions')
Run Code Online (Sandbox Code Playgroud)

我从这里得到以下错误:

sqlalchemy.exc.InvalidRequestError
InvalidRequestError: When initializing mapper Mapper|Auction|auction, expression
    'Item' failed to locate a name ("name 'Item' is not defined"). If this is a
    class name, consider adding this relationship() to the Auction class after
    both dependent classes have been …
Run Code Online (Sandbox Code Playgroud)

python sqlalchemy relationships pyramid

27
推荐指数
5
解决办法
1万
查看次数

什么是appengine_config.py

我是一个试图在GAE上构建应用程序的菜鸟.我的应用程序使用的django模板功能超出了0.96版本支持的功能.我无法使用内置的django 1.2库获取应用程序引擎(除了在开发服务器上).

我相信这篇文章可能会解决我的问题,除了我不知道appengine_config.py是什么.我想我应该把它包含在我的项目中,但是在哪里以及如何?除了上面提到的帖子中的片段之外,应该包含哪些内容?

谢谢!

google-app-engine

8
推荐指数
1
解决办法
2639
查看次数

将小型应用程序迁移到高复制数据存储区

谷歌目前的建议是所有应用程序都开始迁移到高复制数据存储区.我的应用很小,仍处于开发阶段.我的理解是,我的应用程序累积的数据越多,转换过程就越多.所以我决定迁移ASAP(而我仍然只有56k的用户数据).

我按照从主从应用程序下载所有数据的文档.我有下载的数据.我已将我的应用程序部署到高度复制.当我尝试使用upload命令(来自文档中的相同部分)但是我收到错误.这是我正在尝试运行的内容:

C:\Users\Hank\Documents\Aptana Studio 3 Workspace\hanksandbox>appcfg.py upload_data --application=essayhost --kind=User --filename=sandboxed .
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1048, in check_rpc_success raise _ToDatastoreError(err)
google.appengine.api.datastore_errors.BadRequestError: app s~essayhost cannot access app essayhost's data
Run Code Online (Sandbox Code Playgroud)

这是一个很长的追溯的最后一行.如果您需要更多,请告诉我.如果您知道此过程的完整,全面的演练,请链接它.我所发现的大部分内容都有点超出我的深度.

PS任何人都知道如何一次上传所有种类?

python google-app-engine

6
推荐指数
1
解决办法
1142
查看次数

如何在Boto(Amazon S3)的键中添加标签?

我正在尝试标记已上传到S3的密钥。在下面的相同内容中,我只是从字符串创建文件。获得密钥后,我不确定如何标记文件。我已经尝试了Tag以及TagSet。

from boto.s3.bucket import Bucket
from boto.s3.key import Key
from boto.s3.tagging import Tag, TagSet

k = Key(bucket)
k.key = 'foobar/somefilename'
k.set_contents_from_string('some data in file')

Tag(k, 'the_tag')
Run Code Online (Sandbox Code Playgroud)

python amazon-s3 boto boto3

6
推荐指数
3
解决办法
5557
查看次数

django INCLUDE标记只接受一个参数(不能使用WITH)

当我尝试使用以下包括

{% include 'stream_doc.html' with doc=draft %}
Run Code Online (Sandbox Code Playgroud)

在我的HTML(draft是循环迭代的上下文中的对象),我得到错误:

  File "C:\Program Files (x86)\Google\google_appengine\lib\django_1_2\django\template\loader_tags.py", line 210, in do_include
raise TemplateSyntaxError("%r tag takes one argument: the name of the template to be included" % bits[0])
TemplateSyntaxError: u'include' tag takes one argument: the name of the template to be included
Run Code Online (Sandbox Code Playgroud)

谁能告诉我发生了什么事?据我所知,我正在关注Django 文档.这是我在app引擎中无法做到的事情吗?

django google-app-engine

1
推荐指数
1
解决办法
1196
查看次数

python编码/解码问题

我正在尝试使用python的Template对象来创建HTML电子邮件.但是,当应用程序尝试发送电子邮件时,我收到错误:

File "/base/data/home/apps/hanksandbox/1.350486862928605153/main.py", line 573, in post
html = messages.email_document_html(document)
File "/base/data/home/apps/hanksandbox/1.350486862928605153/messages.py", line 109, in email_document_html
description = document.get_description()
File "/base/python_runtime/python_dist/lib/python2.5/string.py", line 170, in substitute
return self.pattern.sub(convert, self.template)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 763: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

错误引用的代码如下所示:

def email_document_html(document):
email_document = Template("""
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    ${stylesheet}
</head>
<html>
<body>
<h1 id="mainhead">Essays</h1>
<div class="document">
<span class="info">At ${date} ${author} published:</span><br/><hr/>
<a href="${domain}/${author}/document/${filename}/" target="_blank"><h1 class="title">${title}</h1></a> …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine

1
推荐指数
1
解决办法
838
查看次数