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.

Pyramid is a small, fast, down-to-earth Python web application development framework that is un-opinionated and very flexible. This allows it to be used in a variety of different projects where Pyramid's flexibility allows for easier integration with already-existing code/modules. Because it is un-opinionated it gives the developer a lot of choice in how to handle various aspects - such as sessions, authentication, authorization and more - without sacrificing support for those aspects or out-of-box ease of use.

It is developed as part of The Pylons Project. It is licensed under a BSD-like license with extra clauses.

Official Logo

Official Pyramid Logo

Official Icon

Official Pyramid Icon

2212 questions
16
votes
4 answers

Using a different schema for the same declarative Base in sqlalchemy

I am new to both Pyramid and SQLAlchemy. I am working on a Python Pyramid project with SQLAlchemy. I have a simple model set up below. How would I go about being able to use this with different schemas at run-time? This will be a PostgreSQL…
Thomas Farvour
  • 1,103
  • 2
  • 11
  • 24
16
votes
2 answers

Pyramids route_url with additional query arguments

In Pyramids framework, functions route_path and route_url are used to generate urls from routes configuration. So, if I have route: config.add_route('idea', 'ideas/{idea}') I am able to generate the url for it using request.route_url('idea',…
Samuel Hapak
  • 6,950
  • 3
  • 35
  • 58
15
votes
3 answers

Getting the request IP address with Pyramid

I'm using Pyramid framework and I want to access the IP address from which the request originated. I assume it's in the request object (passed to every view function) somewhere, but I can't find documentation which tells me where it is.
J-bob
  • 8,380
  • 11
  • 52
  • 85
15
votes
2 answers

SQLAlchemy StaleDataError on deleting items inserted via ORM sqlalchemy.orm.exc.StaleDataError

I'm having an issue where I get a an error such as this one: "MyPyramidApplication Error": DELETE statement on table 'page_view' expected to delete 6 row(s); Only 0 were matched. So, I have a good idea…
cduruk
  • 2,525
  • 2
  • 18
  • 21
15
votes
1 answer

Pyramid and .ini configuration

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 =…
evgeny
  • 2,564
  • 17
  • 27
15
votes
5 answers

Pyramid CORS for Ajax requests

Is it possible automatically add Access-Control-Allow-Origin header to all responses which was initiated by ajax request (with header X-Requested-With) in Pyramid?
drnextgis
  • 2,194
  • 1
  • 25
  • 32
15
votes
1 answer

Validation in SQLAlchemy

How can I get the required validator in SQLAlchemy? Actually I just wanna be confident the user filled all required field in a form. I use PostgreSQL, but it doesn't make sense, since the tables created from Objects in my models.py file: from…
James May
  • 1,371
  • 3
  • 20
  • 37
15
votes
3 answers

SQLAlchemy logging of changes with date and user

This is very similar to another question that's over 3 years old: What's a good general way to look SQLAlchemy transactions, complete with authenticated user, etc? I'm working on an application where I'd like to log all changes to particular tables.…
Tim Tisdall
  • 9,914
  • 3
  • 52
  • 82
15
votes
2 answers

Use different .ini file for alembic.ini

I'm attempting to configure SQLAlchemy Alembic for my Pyramid project and I want to use my developement.ini (or production.ini) for the configuration settings for Alembic. Is it possible to specify the .ini file I wish to use anywhere within…
Vincent Catalano
  • 2,259
  • 4
  • 22
  • 29
15
votes
3 answers

how can i get the ini data in pyramid?

There is a development.ini or production.ini in a pyramid project. I add my own config data in the ini files like: [thrift] host = 0.0.0.0 port = 8080 and I want to use the config data in one of py files in the project. How can I get the data…
Tallmad
  • 1,951
  • 4
  • 22
  • 29
14
votes
2 answers

Multiple domains and subdomains on a single Pyramid instance

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…
Jonathan Ong
  • 19,927
  • 17
  • 79
  • 118
14
votes
1 answer

Help improve my file upload method (Pyramid framework)

Currently, I am using the following method for uploading files (via HTML form) in Pyramid. if request.params.get('form.submitted'): upload_directory = os.getcwd() + '/myapp/static/uploads/' my_file = request.POST.get('thumbnail') …
sidewinder
  • 3,013
  • 6
  • 24
  • 33
14
votes
4 answers

How to find the cause of "task queue depth" warnings from waitress?

Is there a recommended way to diagnose the cause of task queue depth warnings like the one below from waitress? Perhaps there is some way to log queued tasks / requests? 2019-04-25 14:45:23,048 WARNI [waitress.queue:122][MainThread] Task queue…
benvc
  • 14,448
  • 4
  • 33
  • 54
14
votes
6 answers

Equivalent of template context in Pyramid (pylons user)

What is the equivalent of template context in Pyramid? Does the IBeforeRender event in pyramid have anything to with this? I've gone through the official documentation but diffcult to understand what the IBeforeRender event is exactly.
sidewinder
  • 3,013
  • 6
  • 24
  • 33
14
votes
4 answers

SQLAlchemy - condition on join fails with AttributeError: Neither 'BinaryExpression' object nor 'Comparator' object has an attribute 'selectable'

I'm running SQLAlchemy with Pyramid. I'm trying to run a query with a custom 'join' condition : DBSession.query(A)\ .outerjoin(A.b, B.a_id == A.id)\ .all() however the query fails the following error : AttributeError: Neither…
Eino Gourdin
  • 4,169
  • 3
  • 39
  • 67