小编Ben*_*shi的帖子

git push heroku master:Heroku推送被拒绝,没有检测到Cedar支持的应用程序

我试过跑:

$ git push heroku master    
-----

Total 7121 (delta 2300), reused 6879 (delta 2228)
 !     Heroku push rejected, no Cedar-supported app detected

To git@heroku.com:fierce-atoll-4127.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:fierce-atoll-4127.git'
Run Code Online (Sandbox Code Playgroud)

我发现的唯一可能的答案表明,如果您的应用名称中有下划线,则可能会导致此问题.我有一个" - ",我把它删除了,但我仍然无法完成这项工作.

以下是我的requirements.txt,它位于我的src文件夹下,与settings.py和manage.py一起.

Django==1.4.3
South==0.7.6
distribute==0.6.31
ipython==0.13.1
wsgiref==0.1.2
dj-database-url==0.2.0
Run Code Online (Sandbox Code Playgroud)

django github heroku

17
推荐指数
3
解决办法
2万
查看次数

/ usr/bin/ssh-copy-id:第1行:找不到ucgi :: command

我按照http://www.devthought.com/2009/09/19/get-ssh-copy-id-in-mac-os-x/上的说明操作,以便在我的mac上运行ssh-copy-id .现在我在运行时遇到错误:ssh-copy-id

/usr/bin/ssh-copy-id: line 1: ucgi:: command not found
stat: script:: stat: No such file or directory
stat: No: stat: No such file or directory
stat: such: stat: No such file or directory
stat: file: stat: No such file or directory
stat: or: stat: No such file or directory
stat: directory: stat: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我试着按照这里的说明操作:https://github.com/beautifulcode/ssh-copy-id-for-OSX但我每次运行ssh-copy-id都会得到同样的错误.我如何解决我的情况并开始ssh-copy-id正常工作?

macos ssh chmod

6
推荐指数
2
解决办法
7750
查看次数

无法为'created_by'创建表单字段,因为尚未加载其相关模型'users.User'

我最近安装了Blogango,我遇到以下错误:

CommandError: One or more models did not validate:
 blogango.blogentry: 'created_by' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
Run Code Online (Sandbox Code Playgroud)

所以我添加了settings.AUTH_USER_MODEL,现在我收到以下消息:

ValueError: Cannot create form field for 'created_by' yet, because its related model 'users.User' has not been loaded yet
Run Code Online (Sandbox Code Playgroud)

我通过我调用的settings.py AUTH_USER_MODEL = 'users.User',然后将它向上移动到settings.py上以尝试更快地加载它.

按照要求: created_by = models.ForeignKey(settings.AUTH_USER_MODEL, unique=False)

我该怎么做才能解决这个问题?

django

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

用Python解决CodingBat制砖难题

我正在完成 CodingBat问题:

我们要制作一排长为目标英寸的砖。我们有许多小砖(每个1英寸)和大砖(每个5英寸)。如果可以通过选择给定的砖块来达成目标,则返回True。这比看起来要难一点,并且可以完成而没有任何循环。

make_bricks(3, 1, 8) ? True
make_bricks(3, 1, 9) ? False
make_bricks(3, 2, 10) ? True
Run Code Online (Sandbox Code Playgroud)

我写:

if small + big * 5 >= goal: return True
else: return False
Run Code Online (Sandbox Code Playgroud)

我的错误是:make_bricks(3, 2, 9)False(我说真的是因为(2 * 5)+ 3 = 13大于9。

make_bricks(2, 1000000, 100003) ? False
make_bricks(1, 4, 12) ? False
Run Code Online (Sandbox Code Playgroud)

我找到了这个答案,却没有通过那些测试:

if goal > small + big * 5:
  return False
else:
  return goal % 5 <= small
Run Code Online (Sandbox Code Playgroud)

我真的不明白为什么,有人可以解释一下吗?

python

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

构建站点地图,获取:'经理'对象不可订阅

我正在为Django构建一个站点地图.我主要按照djangoproject站点地图上的说明进行操作

这是我的错误消息:

lib/python2.7/site-packages/django/core/paginator.py", line 45, in page
    return Page(self.object_list[bottom:top], number, self)
TypeError: 'Manager' object is not subscriptable
Run Code Online (Sandbox Code Playgroud)

这是我的sitemap.py:来自django.contrib.sitemaps导入来自blog.models的Sitemap导入文章

class BlogSitemap(Sitemap):
    changefreq = "monthly"
    priority = 0.5

    def items(self):
        return Article.objects

    def lastmod(self, obj):
        return obj.created_at

    def location(self, obj):
        return obj.get_absolute_url(False)
Run Code Online (Sandbox Code Playgroud)

这是我的urls.py:

sitemaps = {
    'blog' : BlogSitemap,
    }
urlpatterns = ...
    ...),
      url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})
        )
Run Code Online (Sandbox Code Playgroud)

如何启动并运行我的sitemap.xml?

python sitemap django

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

标签 统计

django ×3

python ×2

chmod ×1

github ×1

heroku ×1

macos ×1

sitemap ×1

ssh ×1