heroku

Rails app hangs when there's a server sent event (SSE) that requires database actions

大兔子大兔子 提交于 2020-12-07 06:40:26
问题 I'm learning & doing SSE for the first time in rails! My controller code: def update response.headers['Content-Type'] = 'text/event-stream' sse = SSE.new(response.stream, event: 'notice') begin User.listen_to_creation do |user_id| sse.write({id: user_id}) end rescue ClientDisconnected ensure sse.close end end Front end: var source = new EventSource('/site_update'); source.addEventListener('notice', function(event) { var data = JSON.parse(event.data) console.log(data) }); Model pub/sub class

Rails app hangs when there's a server sent event (SSE) that requires database actions

半世苍凉 提交于 2020-12-07 06:40:06
问题 I'm learning & doing SSE for the first time in rails! My controller code: def update response.headers['Content-Type'] = 'text/event-stream' sse = SSE.new(response.stream, event: 'notice') begin User.listen_to_creation do |user_id| sse.write({id: user_id}) end rescue ClientDisconnected ensure sse.close end end Front end: var source = new EventSource('/site_update'); source.addEventListener('notice', function(event) { var data = JSON.parse(event.data) console.log(data) }); Model pub/sub class

How to add a Spacy model to a requirements.txt file?

别来无恙 提交于 2020-12-05 10:24:03
问题 I have an app that uses the Spacy model "en_core_web_sm". I have tested the app on my local machine and it works fine. However when I deploy it to Heroku, it gives me this error: "Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory." My requirements file contains spacy==2.2.4. I have been doing some research on this error and found that the model needs to be downloaded separately using this command: python -m spacy

Django: Not Found static/admin/css

别说谁变了你拦得住时间么 提交于 2020-12-04 15:50:05
问题 I just deployed my first Django app on Heroku but I notice that it doesn't have any CSS like when I runserver on the local machine. I know there's something wrong with static files but I don't understand much about it even when I already read the docs. I can do python3 manage.py collectstatic to create a static folder but I don't know where to put it and how to change the DIRS in settings.py. I really need some help to get rid of it. settings.py: DEBUG = True INSTALLED_APPS = [ 'django

Django: Not Found static/admin/css

别等时光非礼了梦想. 提交于 2020-12-04 15:42:00
问题 I just deployed my first Django app on Heroku but I notice that it doesn't have any CSS like when I runserver on the local machine. I know there's something wrong with static files but I don't understand much about it even when I already read the docs. I can do python3 manage.py collectstatic to create a static folder but I don't know where to put it and how to change the DIRS in settings.py. I really need some help to get rid of it. settings.py: DEBUG = True INSTALLED_APPS = [ 'django

Django: Not Found static/admin/css

ぐ巨炮叔叔 提交于 2020-12-04 15:39:26
问题 I just deployed my first Django app on Heroku but I notice that it doesn't have any CSS like when I runserver on the local machine. I know there's something wrong with static files but I don't understand much about it even when I already read the docs. I can do python3 manage.py collectstatic to create a static folder but I don't know where to put it and how to change the DIRS in settings.py. I really need some help to get rid of it. settings.py: DEBUG = True INSTALLED_APPS = [ 'django

Heroku Python socket connection fails

二次信任 提交于 2020-12-04 02:28:44
问题 I'm trying to deploy a python socket server to Heroku, but it seems that the socket connection is not well made... In my case, the accept() method should wait for a socket connection to be made, but it seems that it fires even if I don't run my client.py script... Also, when running the client, the connection is indeed made, but the server doesn't receive nor send any data... What am I doing wrong? All of this works locally... (changing the port from 80 to 12345 and the address to localhost).

Heroku Python socket connection fails

℡╲_俬逩灬. 提交于 2020-12-04 02:19:43
问题 I'm trying to deploy a python socket server to Heroku, but it seems that the socket connection is not well made... In my case, the accept() method should wait for a socket connection to be made, but it seems that it fires even if I don't run my client.py script... Also, when running the client, the connection is indeed made, but the server doesn't receive nor send any data... What am I doing wrong? All of this works locally... (changing the port from 80 to 12345 and the address to localhost).

从DevOps到Cloud Native,应用上云姿势全解锁

懵懂的女人 提交于 2020-12-03 07:43:34
本文由 网易云 发布。 作者: 林帆 序文 伴随着IaaS、PaaS等云端基础设施技术的成熟,“应用上云”成为许多企业软件部门的心头大事。通过把传统软件系统搬到云上,一方面可以让业务方获得更多的资源灵活性,另一方面也可以缓解运营方的成本压力,让硬件资源不再成为阻碍流量和业务增长的障碍。上云这件看起来轻松的事,其实却是一项系统性的工程。只有到真正做起来时候才会发现一地鸡毛的问题,且不说技术方面引入的变化,组织部门隔阂、开发流程陈旧、配套工具落后、人员意识保守...随时冒出来状况,足以让这个许多人最初以为只是改改架构重新部署的工作变得复杂度远超预期。 特别是在早几年时候,“云原生应用”的概念比较模糊,应用上云到底要做哪些事情并没有过权威明确的定义。虽然有Google、Facebook和许多国内外互联网企业总结出的案例,但都不具有普适性,一些规模不大的企业照搬照抄效仿,试图一步到位,结果落得邯郸学步的下场。从这个角度来看,网易云出品的 《云原生应用架构实践》 的确是一本可以让人眼前一亮的书,它 针对互联网应用前期拼灵活、中期拼增长、后期拼稳定的特点,明确的指出了处于不同规模和时期的企业,实施上云策略应该完全不同,并针对三种典型的发展阶段阐述了企业应该采用的实践和转型途径 。 图片来自互联网 从DevOps到Cloud Native 运用“云原生应用”架构的一条很重要原则是

How to add python dependencies to heroku node server?

纵饮孤独 提交于 2020-12-01 09:59:45
问题 I have a Heroku app that's running Node, but I need to be able to run Python scripts on this server. I'm trying to install my Python dependencies but can't get it to work. I've added both python and node build packs to my project, I've create a virtual environment and successfully installed requirements.txt, but I continue to get module not found errors. How can I properly install Python packages on a Heroku Node server? Heroku shows that I have correctly set both buildpacks: heroku