Questions tagged [pyramid]

Pyramid is a Python-based web framework provided by the Pylons Project. Do not use the "pyramid" tag for displaying items in a pyramid shape.

Filter by
Sorted by
Tagged with
2 votes
0 answers
25 views

How to make uWSGI server stop if an application raised exception on load?

Simple reproducible example: project structure: . ├── app.ini ├── app.py ├── uwsgi.ini └── wsgi_run.py app.ini [app:main] use = call:app:main pyramid.reload_templates = true pyramid....
rzlvmp's user avatar
  • 7,952
0 votes
1 answer
60 views

How to serve Yolo 8 captured frames using Pyramid web server

I'm a newbie and haven't worked with the Pyramid library/framework before. I have a script that, based on yolo and supervision, detects, tracks and counts objects. It works great. Previously, I used ...
Norbert  Yuhas's user avatar
1 vote
0 answers
29 views

In project build results, Python Pyramid referencing a view source file that no longer exists

In a Python Pyramid project, I tried to rename a project view file temporarily while testing a new version of this file. Originally, the project started with the following view file: /myproject/...
Tim D's user avatar
  • 670
1 vote
1 answer
51 views

CORS prefetch error in python pyramid application

I have a webapp front end built in reactjs and calling a api built using python pyramid. When I test this application in local development, I deploy the webapp in localhost:6543 and python application ...
user1050619's user avatar
  • 20.1k
1 vote
1 answer
79 views

How to create a minimal standalone WEB application with Django

Using Pyramid framework a minimal standalone (i.e. not using external WEB server) WEB application can be created as follows: from wsgiref.simple_server import make_server from pyramid.config import ...
cppdev's user avatar
  • 43
1 vote
1 answer
69 views

How to properly associate SQLAlchemy session with pyramid sessions in Pyramid?

In pyramid, I'm connecting to database with credentials supplied by user: every HTTP session have its own database connection, with different credentials. It works fine, if I'm opening and closing ...
Jarek's user avatar
  • 329
2 votes
1 answer
82 views

Swagger Documentation for Python Pyramid Application

I have an old python pyramid web application and I just wanted to create an API documentation (specifically Swagger or OpenAPI3) for it. Is there a way to do that without writing the entire swagger ...
thakreyn's user avatar
0 votes
1 answer
27 views

Only allow access view from specific view

I have registered two views: config.add_route("home", "/home") config.add_route("home/data", "home/data") /home view has some Javascript code in the frontend ...
Thong Nguyen's user avatar
1 vote
1 answer
26 views

Get HTML pape after Javascript loaded with webtest

So I run Pyramid application and have a .pug template with embedded JS which will run after page loaded. extends base.pug block subcontent .container h1 Homepage block scripts script....
Thong Nguyen's user avatar
0 votes
0 answers
11 views

Passing view param while invoke_subrequest

So I have 2 views and I want to setting a new search_cache while invoking view1 from view2. Can we do it in Pyramid? @view_config(route_name="view1", request_method=["POST"], ...
Thong Nguyen's user avatar
0 votes
0 answers
32 views

sqlalchemy.orm.exc.DetachedInstanceError - concurency problem in Pyramid with waitress

I have a simple query loading records from view (PostgreSQL): rows = DBSession.query(MyView).all() next, I'm processing rows, copying them to rows1: for row in rows: # some ...
Jarek's user avatar
  • 329
1 vote
1 answer
78 views

cookiecutter step when installing Pyramid application throws module not found error

I was trying to create Pyramid application using cookiecutter. After installing cookiecutter in my Debian GNU/linux 10 system and adding the path of ~/local to bash profile, the cookiecutter ...
tanzeem's user avatar
  • 161
1 vote
1 answer
50 views

Formatting the time slot of a Pylon's deform.widget.DateTimeInputWidget

Needs I need to customize a deform.widget.DateTimeInputWidget, especially to get rid of the seconds in the input time slot so that the user doesn't need to specify them. By default seconds have to be ...
swiss_knight's user avatar
  • 6,217
0 votes
1 answer
57 views

mock a function inside python pyramid view

I have a python pyramid view and want to write a unittest. def home(request): state = request.params.get('redirect', None) cookie = request.headers.get('Cookie') user = ...
user1050619's user avatar
  • 20.1k
1 vote
1 answer
48 views

Pyramid + SQLAlchemy + Zope App returns wrong results with raw SQL

I have a Pyramid 2.X + SQLAlchemy + Zope App created using the official CookieCutter. There is a table called "schema_b.table_a" with 0 records. In the below view count(*) should be more ...
QLands's user avatar
  • 2,464
1 vote
1 answer
19 views

How do I make my image recourses synchronize for clients when they change on the host?

I am currently working with pyramid and have a png that changes as users interact with the site. I would like it to update on the client when it is modified on the server. As of now you have to ...
kpie's user avatar
  • 10.7k
1 vote
0 answers
102 views

Pyramid/ Sqlalchemy - IntegrityError during tests

I am doing pytest on a basic data insertion method in a table 'search', which is connected to table 'user' using foreign key. I have also created test data in the json format.I have created a fixture ...
VivekPatil's user avatar
0 votes
0 answers
105 views

How to integrate python-socketio events with Pyramid views?

I am working on a Pyramid python application which employs python-socketio to communicate with the frontend, but I find no information about how best to integrate the my Pyramid views and models with ...
pascalin's user avatar
1 vote
0 answers
24 views

Get `request.authenticated_userid` in `tween`

Can I access request.authenticated_userid in a tween? According to https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/router.html authorization appears to happen within the territories ...
coler-j's user avatar
  • 1,845
1 vote
0 answers
51 views

Running pyramid and django side by side

We have a pyramid application that provides API endpoint. Now we want to implement frontend as well but to our surprise, i10n/l10n tooling in pyramid is not as good as in django. So I have been ...
k4ml's user avatar
  • 1,226
1 vote
1 answer
106 views

python pyramid set cookie - redirect url

I have a python pyramid application with multiple resources, Each resource if its not authenticated need to be redirected to a 3rd party for authentication. The 3rd party(once authenticated) will ...
user1050619's user avatar
  • 20.1k
-1 votes
1 answer
83 views

is it possible to use database connection in python pyramid tween?

I would prepare a tracking system for my application and check every request if it has a special value in the query parameter. In order to do that I created a tween and this tween checks for this ...
Rogalek's user avatar
  • 50
2 votes
1 answer
1k views

Setting application URL prefix with Gunicorn

I am currently moving Pyramid WSGI based application from the Waitress web server to Gunicorn web server due to multiprocess pooling support. Currently, the application is being served with Waitress ...
Mikko Ohtamaa's user avatar
0 votes
0 answers
194 views

Why does SqlAlchemy not close database connections

I have a pyramid==1.10.4, SQLAlchemy==1.3.19 and pymssql==2.2.1 setup to use the default QueuePool with {pool_size: 5, max_overflow: 40, pool_recycle: 3600 } but it does not close connections when it ...
user4426017's user avatar
  • 1,970
0 votes
1 answer
97 views

how to access authentication timeout value from a template in pyramid

Setup During start-up of my Pyramid (version 1.10.5) application, I set an authentication timeout so that sessions expire after a duration of inactivity by the user, which works as expected. ...
Arthur Hebert-Ryan's user avatar
1 vote
0 answers
64 views

Python Pyramid unit testcase Dummyrequest: needs to convert file path to "webob.compat.cgi_FieldStorage"

I have created following API in pyramid. @view_config(route_name="/demo", renderer="json", request_method="POST") def file_attachment(self): file = self....
Harsha Biyani's user avatar
1 vote
0 answers
171 views

Python Pyramid: image upload giving request.DisconnectionError

I am writing a code to upload image using Python Pyramid framework. This is the sample code I have written: from pyramid.view import view_config from wsgiref.simple_server import make_server from ...
Harsha Biyani's user avatar
1 vote
1 answer
75 views

How to get permission name that causes forbidden error?

I want to know permission name that causes forbidden error, get it in forbidden view and return to user. How to do it? Pyramid version 1.10.4 ... # if user does not have PERMISSIONS.name that causes ...
dabajabaza's user avatar
2 votes
1 answer
54 views

How to create an application with python pyramid 1.2 version using anaconda prompt?

The steps i followed to create a new project :- I created a new kernel using the command and installed python 3.5 version conda create -n pyramid_kernel python=3.5 Then i activated the kernel conda ...
Sapti Sunil's user avatar
1 vote
1 answer
39 views

Accessing list of registered factories/services in wired/pyramid_services

I'm trying to debug my usage of wired and pyramid_services as well as migrate from using named services to registering services with interfaces and context classes. Is there a way to see everything ...
Ian Wilson's user avatar
  • 6,543
1 vote
1 answer
229 views

Pyramid fileresponse with header

I'm returning an image to my webpage with a pyramid fileResponse like this: response = FileResponse(newPath) response.content_disposition = f'attachment; filename="{newImage}"' return ...
Jesper's user avatar
  • 1,027
0 votes
1 answer
50 views

control order that routes are matched when using a custom directive/action

I have a catchall route that is catching my request before my call to add_route within an action created with a custom directive. How can I prevent that from happening? Ie. manually place the ...
Ian Wilson's user avatar
  • 6,543
1 vote
0 answers
56 views

How to get Pyramid renderred array in Javascript of pug template

So I have a Pyramid view @view_config(route_name='myview', renderer='myview.pug') def myview(self): myarray = [1, 2, "abc"] return { 'myarray': myarray, ...
Thong Nguyen's user avatar
1 vote
0 answers
109 views

How to enable google authentication in pyramid framework?

Created client id and secret id using this link https://console.cloud.google.com/ How to proceed the next step to communicate google-oauth in pyramid framework?
P Pariventhan's user avatar
3 votes
1 answer
85 views

Pyramid can not access static asset (neither an .jpg image nor a .js file)

I have a bigger testcase which uses Pyramid and Mako and also Javascript. It works fine unless I put the Javascript code into a separate file. Then it fails. I have reduced the test case to the ...
vnick's user avatar
  • 31
4 votes
1 answer
6k views

Recover from PendingRollbackError and allow subsequent queries

We have a pyramid web application. We use [email protected] with Zope transactions. In our application, it is possible for an error to occur during flush as described here which causes any subsequent ...
coler-j's user avatar
  • 1,845
2 votes
1 answer
89 views

possible weird bug in pyramid web framework

I was following pyramid web framework tutorial steps given in the link: https://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/cookiecutters.html After setting it up and visiting ...
codefire's user avatar
  • 393
1 vote
2 answers
263 views

In python pyramid web framework, how can I drop all db table rows before seeding?

I am using a cookiecutter to make a pyramid web app. It has a function to seed the db here: https://github.com/Pylons/pyramid-cookiecutter-starter/blob/latest/%7B%7Bcookiecutter.repo_name%7D%7D/%7B%...
spacether's user avatar
  • 2,196
1 vote
1 answer
202 views

Could not find a matching loader for the scheme "file+ini ", protocol "wsgi" when running a Pyramid project in PyCharm (Professional version)

I got an error about 'could not find a matching loader for the scheme' when I want to run my Pyramid web app in PyCharm based on Pyramid server. However, if I directly run pserve myapp.ini in terminal,...
htlbydgod's user avatar
  • 350
3 votes
1 answer
167 views

Optional url segment pattern in a Pyramid route

I'm trying to create a website with optional url sub-paths: /user - Returns general information on users /user/edit - Edits the user I've tried setting: config.add_route('user', '/user/{action}') @...
match's user avatar
  • 10.6k
3 votes
1 answer
119 views

Python Pyramid capturing null byte attacks

I have a Pyramid web app with fail2ban set up to jail ten consecutive 404 statuses (i.e. bots that probe for vulnerabilities), Sentry error logging and, as far as I know, there are no security ...
Matteo Ferla's user avatar
  • 2,182
3 votes
1 answer
109 views

@reify executes database queries every time called?

Based on this comment about reify, It acts like @property, except that the function is only ever called once; after that, the value is cached as a regular attribute. This gives you lazy attribute ...
maudev's user avatar
  • 989
0 votes
0 answers
174 views

Using React fetch gives pyramid.exceptions.PredicateMismatch: The resource could not be found

I am writing a React web client that use a REST API to communicate to a Python Pyramid backend. Problem is that only the methods POST and GET works. All other give error on the server. Also I can only ...
kaolsson's user avatar
0 votes
0 answers
234 views

Trouble returning with a Pyramid backend and a React JS frontend

I am developping a RESTful API with a Pyramid backend and a JS frontend. The frontend can send JSON to the backend and the backend can receive. I tested the frontend with JSONplaceholder and It worked,...
Little's user avatar
  • 1
1 vote
1 answer
62 views

How can one combine pyramid_beaker decorator-style caching and pyramid_tm?

With Pyramid / pyramid_tm I end up passing around the dbsession object that joined the current transaction to methods that encapsulate my code. For example def get_item_name(dbsession, item_id): ...
barbaz's user avatar
  • 1,672
1 vote
1 answer
252 views

How do I do dependency injection in a python's pyramid view callable?

Suppose I have a class from pyramid.request import Request from pyramid.view import view_config def includeme(config): config.add_route('items', '/v1/items' class MyView(): def __init__(self,...
user4426017's user avatar
  • 1,970
0 votes
0 answers
111 views

Filter PII data in Pyramid framework

I'm trying to hide body request from logs in Pyramid web application. It uses default python logging package. This is .ini file: [logger_api] level = DEBUG handlers = qualname = api [...
Atef Arfaoui's user avatar
20 votes
6 answers
30k views

`UnencryptedCookieSessionFactoryConfig` error when importing Apex

I'm trying to use Apex and whenever I try to import it (or anything involving it) I get the following traceback: Traceback (most recent call last): File "<stdin>", line 1, in <...
Sean's user avatar
  • 2,980
0 votes
1 answer
104 views

upgrading existing config.add_route, pyramid 1.4 to 1.10

Code I'm working on: def add(self, path, view, method='GET'): url = _join_url_paths(self.path_prefix, path) id_ = hashlib.md5('%s-%s' % (url, method)).hexdigest() view = ...
Omar's user avatar
  • 309
0 votes
1 answer
256 views

Custom templates and validation with Deform and mako

I am using deform in a project that uses pyramid with mako as a templating engine. I rewrote the templates for the widgets I need. I am using a modal for one of the forms so I wrote the mako template ...
Camilo Gomez's user avatar

1
2 3 4 5
45