V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
catsky
V2EX  ›  分享创造

类36kr风格flask blog系统开源

  •  
  •   catsky ·
    catsky · 2013-08-01 22:12:30 +08:00 · 9668 次点击
    这是一个创建于 4135 天前的主题,其中的信息可能已经有所发展或是发生改变。
    第一次学flask,这个作为练手的项目,前前后后折腾了一个多月。感谢有很多可以直接用的,开源的轮子,否则2个月也搞不出来。。。Flask, SQLAlchemy, Kissy (taobao editor), Sinaapp Mysql, Sinaapp Storage, flaskblog, 36kr的前端CSS....

    以前接触过django,中间断断续续始终没有坚持下去,总觉得太复杂,用了flask以后,发现比django容易上手多了。建议像我一样的初学者,建议从flask入手。

    Github: https://github.com/catsky/rebang
    Demo: http://rebang.sinaapp.com

    因为微信公众号积累了一些用户,接下来准备做
    1.微信的回复自动推送
    2. 微信关注用户之间的聊天系统。(感觉这个更有趣点)

    感兴趣的童鞋请watch/fork,现在每天下班都在干这个。
    第 1 条附言  ·  2013-08-04 00:19:46 +08:00
    文章内容的微信自动推送完成。已更新至github。

    另,打算把这个demo站搞成一个澳洲移民,澳洲生活的小站,反正现在自己也在关注澳洲移民的情况,把收集的信息分享出来,也算自己做了件有意思的事:)

    找了个更贴近demo内容的二级子域名: http://australian.sinaapp.com/
    打算长期维护这个站点,最新开发的功能都会应用在该站点上。
    22 条回复    2016-07-12 13:27:51 +08:00
    Showfom
        1
    Showfom  
       2013-08-02 10:43:00 +08:00   ❤️ 1
    第一次点进去的时候出错了

    Traceback (most recent call last):
    File "/usr/local/sae/python/lib/python2.7/site-packages/sae/__init__.py", line 18, in new_app
    return app(environ, start_response)
    File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1306, in __call__
    return self.wsgi_app(environ, start_response)
    File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1294, in wsgi_app
    response = self.make_response(self.handle_exception(e))
    File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1292, in wsgi_app
    response = self.full_dispatch_request()
    File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1062, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1060, in full_dispatch_request
    rv = self.dispatch_request()
    File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1047, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
    File "/data1/www/htdocs/634/rebang/1/chartnet/view/views.py", line 190, in detailpost
    _article = operatorDB.detail_post_by_id(post_id)
    File "/data1/www/htdocs/634/rebang/1/chartnet/view/models.py", line 330, in detail_post_by_id
    article = Article.query.filter_by(_id=_id).first()
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1963, in first
    ret = list(self[0:1])
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1857, in __getitem__
    return list(res)
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2032, in __iter__
    return self._execute_and_instances(context)
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2045, in _execute_and_instances
    close_with_result=True)
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2036, in _connection_from_session
    **kw)
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 719, in connection
    close_with_result=close_with_result)
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 723, in _connection_for_bind
    return self.transaction._connection_for_bind(engine)
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 249, in _connection_for_bind
    self._assert_is_active()
    File "/usr/local/sae/python/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 177, in _assert_is_active
    "This Session's transaction has been rolled back "
    InvalidRequestError: This Session's transaction has been rolled back by a nested rollback() call. To begin a new transaction, issue Session.rollback() first.
    catsky
        2
    catsky  
    OP
       2013-08-02 11:20:24 +08:00
    多谢反馈,可惜我这里没法复现诶,还有童鞋碰到这样的问题吗
    我查查ORM层的代码
    Spider
        3
    Spider  
       2013-08-02 11:23:40 +08:00
    同样的错误
    icesnow
        4
    icesnow  
       2013-08-02 11:26:38 +08:00
    也是这个错误
    ivanlw
        5
    ivanlw  
       2013-08-02 11:32:53 +08:00
    同样错误
    tension
        6
    tension  
       2013-08-02 11:39:56 +08:00   ❤️ 1
    第一次点击进去也很多错误!
    catsky
        7
    catsky  
    OP
       2013-08-02 11:41:50 +08:00
    debug了下,发现跟多说api的数据存储有关。先做了一个workaround,大家试试还有没有问题,偶晚上回去再好好看看:)
    firsthym
        8
    firsthym  
       2013-08-03 12:12:10 +08:00
    蛮不错的
    iZr
        9
    iZr  
       2013-08-03 21:49:48 +08:00
    我没有,挺好的.
    Kenny
        10
    Kenny  
       2013-08-04 03:41:00 +08:00 via iPhone
    想肉翻,关注一下
    catsky
        11
    catsky  
    OP
       2013-08-04 09:55:42 +08:00
    @Kenny 多谢, 换了玉米 http://australian.sinaapp.com/, 欢迎长期关注,嘿嘿
    catsky
        12
    catsky  
    OP
       2013-08-04 10:40:47 +08:00
    http://australian.sinaapp.com 上面那个链接多了个逗号
    catsky
        13
    catsky  
    OP
       2013-08-04 22:27:40 +08:00
    今天测试微信自动回复功能,本来一直正常,突然就收不到回复信息了!刚才折腾了好一会,终于找到问题了,其中有一篇文章含有敏感词,导致整条信息都被过滤了。看来要找一张敏感词表,发送微信之前先过滤一遍,否则肯定悲剧。

    哪位v友有整理过这种表吗?谢
    sugarit
        14
    sugarit  
       2013-08-04 22:47:07 +08:00 via iPhone
    @catsky 微信会过滤?
    catsky
        15
    catsky  
    OP
       2013-08-04 23:17:17 +08:00   ❤️ 1
    @sugarit 是的,刚才程序自动回复的时候,包含一篇文章,其内容含有“大*纪*元”这三个字,client端无论如何都无法收到消息。当过滤掉这三个字后,就恢复正常了。
    likai
        16
    likai  
       2013-08-07 18:42:25 +08:00
    @catsky
    ?话说怎么部署在SAE上
    catsky
        17
    catsky  
    OP
       2013-08-07 20:27:52 +08:00
    @likai https://github.com/catsky/rebang#how-to-deploy-on-sinaapp
    部署步骤已更新到github,请参考 :)
    likai
        18
    likai  
       2013-08-07 21:52:13 +08:00   ❤️ 1
    @catsky
    出错了

    Traceback (most recent call last):
    File "/data1/www/htdocs/947/goodbest/1/index.wsgi", line 3, in <module>
    from chartnet import app
    File "/data1/www/htdocs/947/goodbest/1/chartnet/__init__.py", line 21, in <module>
    import view
    File "/data1/www/htdocs/947/goodbest/1/chartnet/view/__init__.py", line 2, in <module>
    import views,models
    File "/data1/www/htdocs/947/goodbest/1/chartnet/view/views.py", line 10, in <module>
    from models import operatorDB
    File "/data1/www/htdocs/947/goodbest/1/chartnet/view/models.py", line 197
    <<<<<<< HEAD
    ^
    IndentationError: expected an indented block
    catsky
        19
    catsky  
    OP
       2013-08-07 22:29:38 +08:00
    @likai sorry,上次github commit的时候没有merge好, 已fix。 请pull 更新此文件 1 / chartnet / view / models.py
    xLzgkddTywk9ALsX
        20
    xLzgkddTywk9ALsX  
       2013-08-07 23:28:35 +08:00
    明天再来看看
    ming
        21
    ming  
       2013-08-08 03:00:29 +08:00
    36kr这么难看的风格有什么好抄的 相当疑惑
    GTim
        22
    GTim  
       2016-07-12 13:27:51 +08:00
    超出配额了,明天来看?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3355 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 12:03 · PVG 20:03 · LAX 04:03 · JFK 07:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.