pyramid

Pyramid and .ini configuration

浪子不回头ぞ 提交于 2019-12-18 11:49:27
问题 Each Pyramid application has an associated .ini file that contains its settings. For example, a default might look like: [app:main] use = egg:MyProject pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound = false pyramid.debug_routematch = false ... I am wondering if it is possible to add your own configuration values in there, and read them at run-time (mostly from a view callable). For instance, I might want to have [app:main] blog.title = "Custom blog

Why is my log level not being used when using loadapp from paste.deploy?

 ̄綄美尐妖づ 提交于 2019-12-18 05:27:12
问题 I want to temporailiy turn on debug messages in a production pyramid web project so I adjusted the production.ini file, pushed it to Heroku and saw only error and warn level messages. So I thought, that seems odd since if I start the pyramid application like the following on my local PC I get all the log level messages. env/bin/pserve production.ini OK, so that's not exactly how it runs on Heroku, it is actually run from a little bit of python that looks like this (in a file called runapp.py

Chameleon templates for javascript files?

此生再无相见时 提交于 2019-12-18 05:05:37
问题 I am developing a simple pyramid application where I am using JQuery to do AJAX requests. I have until now had my javascript code within my chameleon templates. Now I want to extract my javascript into another location (e.g. as static resources). My problem is that I find my javascript code relies on dynamically generated content like so: $.post("${request.route_url('my_view')}",{'data': 'some data'}, function(html){ $("#destination").html(html); }); The dynamic element being: "${request

Multiple domains and subdomains on a single Pyramid instance

断了今生、忘了曾经 提交于 2019-12-17 22:42:14
问题 I'm looking to have multiple domains and subdomains on a single Pyramid instance. However, I can't seem to find any documentation on it. The last question referred to a glossary with very little information and no examples. Do any of you have any examples or can direct me to better documentation? 回答1: Pyramid is just a WSGI application. This means it's dependent on the HTTP_HOST environ key (set by the Host header) to determine the host of the application. It's all relative. Point-being that

Make sure only one worker launches the apscheduler event in a pyramid web app running multiple workers

那年仲夏 提交于 2019-12-17 15:25:48
问题 We have a web app made with pyramid and served through gunicorn+nginx. It works with 8 worker threads/processes We needed to jobs, we have chosen apscheduler. here is how we launch it from apscheduler.events import EVENT_JOB_EXECUTED, EVENT_JOB_ERROR from apscheduler.scheduler import Scheduler rerun_monitor = Scheduler() rerun_monitor.start() rerun_monitor.add_interval_job(job_to_be_run,\ seconds=JOB_INTERVAL) The issue is that all the worker processes of gunicorn pick the scheduler up. We

基于深度学习的图像分割在高德的实践

蹲街弑〆低调 提交于 2019-12-16 11:32:41
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一、前言 图像分割(Image Segmentation)是计算机视觉领域中的一项重要基础技术,是图像理解中的重要一环。图像分割是将数字图像细分为多个图像子区域的过程,通过简化或改变图像的表示形式,让图像能够更加容易被理解。更简单地说,图像分割就是为数字图像中的每一个像素附加标签,使得具有相同标签的像素具有某种共同的视觉特性。 图像分割技术自 60 年代数字图像处理诞生开始便有了研究,随着近年来深度学习研究的逐步深入,图像分割技术也随之有了巨大的发展。早期的图像分割算法不能很好地分割一些具有抽象语义的目标,比如文字、动物、行人、车辆。这是因为早期的图像分割算法基于简单的像素值或一些低层的特征,如边缘、纹理等,人工设计的一些描述很难准确描述这些语义,这一经典问题被称之为“语义鸿沟”。 得益于深度学习能够“自动学习特征”的这一特点,第三代图像分割很好地避免了人工设计特征带来的“语义鸿沟”,从最初只能基于像素值以及低层特征进行分割,到现在能够完成一些根据高层语义的分割需求。 (图像分割的发展历史) 高德地图拥有图像/视频大数据,在众多业务场景上都需要理解图像中的内容。例如,在数据的自动化生产中,通常需要寻找文字、路面、房屋、桥梁、指示牌、路面标线等目标。这些数据里有些是通过采集车辆或卫星拍摄

How to change the template engine in Pyramid?

99封情书 提交于 2019-12-14 03:42:45
问题 In particular I want to use pystache but any guide for another template engine should be good enough to set it up. If I understood correctly, I have to register the renderer factory in the __init__.py of my pyramid application. config = Configurator(settings=settings) config.add_renderer(None, 'pystache_renderer_factory') Now I need to create the renderer factory and don't know how. Even though I found the documentation about how to add a template engine, I didn't manage to set it up. 回答1:

How to Integrate Pyramid 1.1 and Mongo DB - as few lines as possible

时间秒杀一切 提交于 2019-12-14 03:42:31
问题 Goal : I try to integrate Mongo DB with Pyramid 1.1 basic application. Background : Appliation is created by the book (https://docs.pylonsproject.org/projects/pyramid/1.1/narr/project.html#creating-the-project) using basic command "paste create -t pyramid_starter" I followed this cookbook article: https://docs.pylonsproject.org/projects/pyramid_cookbook/dev/mongo.html Problem : It seems that when ever I add MongoDB connection into request I got "Internal Server Error" with I have tried

ViewNotFound while Ajax and Pyramids

老子叫甜甜 提交于 2019-12-13 20:12:40
问题 I'm using Pyramid and got a strange issue. I do an ajax request AR in view A. If the request is done, the user is redirected to view B. If the user goes back to A, the ajax request AR will fail, because pyramid does not find any view for the request. If someone needs code, I'll post it ;-) Thx & Greetings Tobias Edit: Snippet of my init .py # adding all routes config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('main_page', '/') config.add_route('main_contact', '

dynamicly fill table using zpt and ajax as update

谁说我不能喝 提交于 2019-12-13 19:17:12
问题 I'm creating a webproject in pyramid where I'd like to update a table every few secondes. I already decided to use ajax, but I'm stuck on something. On the client side I'm using the following code: function update() { var variable = 'variable '; $.ajax({ type: "POST", url: "/diagnose_voorstel_get_data/${DosierID}", dataType: "text", data: variable , success: function (msg) { alert(JSON.stringify(msg)); }, error: function(){ alert(msg + 'error'); } }); } Pyramid side: @view_config(route_name=