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
14
votes
2 answers

pyramid pserve server as https

Is it possible to run Pyramid's pserve such that it starts an https server (for example https://0.0.0.0:6543)? I would like to gear up my application for https locally if possible.
Roman
  • 8,826
  • 10
  • 63
  • 103
14
votes
2 answers

Transaction manager revert/rollback last commit

I try to speedup my tests by putting test data from test case setUp() to setUpClass()/teardownClass class method, so it does not recreate same select only fixture for every test in test case. @classmethod def setUpClass(cls): …
Aristarhys
  • 2,092
  • 7
  • 37
  • 68
14
votes
4 answers

PyCharm SQLAlchemy autocomplete

I started evaluating PyCharm 3 professional edition because I will be working on several Pyramid + SQLAlchemy projects. One of the things I would really love to have is SQLAlchemy autocomplete. I created a new starter project with the alchemy…
Roland Pish
  • 815
  • 1
  • 9
  • 21
14
votes
3 answers

In the Pyramid web framework, how do I source sensitive settings into development.ini / production.ini from an external file?

I'd like to keep development.ini and production.ini under version control, but for security reason would not want the sqlalchemy.url connection string to be stored, as this would contain the username and password used for the database…
michel-slm
  • 9,438
  • 3
  • 32
  • 31
14
votes
4 answers

Detaching SQLAlchemy instance so no refresh happens

I want to detach an instance of a class from my session but it should still be available for reading (without emitting a query). I have been scanning through the documentation for days now, but every approach I try leads to the…
javex
  • 7,198
  • 7
  • 41
  • 60
13
votes
1 answer

How to unit test code that runs celery tasks?

The app I am working on is heavily asynchronous. The web application runs a lot of tasks through celery depending on user actions. The celery tasks themselves are capable of launching further tasks. Code such as the one shown below occurs in our…
Ranjith Ramachandra
  • 10,399
  • 14
  • 59
  • 96
13
votes
1 answer

Creating databases in SQLAlchemy tests with PostgreSQL

I am building a Pyramid web application which is built on the top of SQLAlchemy and solely relies PostgreSQL as its database backend. What would be a way to have the unit tests structure so that Database is built once per test run - not on every…
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
13
votes
3 answers

Determine the user language in Pyramid

I want to make internationalization for my project. I followed how it is described in official documentation, but localization still doesn't work. Here is how I try get user locale: def get_locale_name(request): """ Return the :term:`locale…
Denis
  • 7,127
  • 8
  • 37
  • 58
12
votes
4 answers

Pyramid: Equivalent of MVC in PHP Frameworks in Pyramid / Python?

What are the Pyramid / Python equivalents of Model - View - Controller of PHP Frameworks such as Kohana? In Pyramid "Model" is .... and it is used for ..... In Pyramid "View" is .... and it is used for ..... In Pyramid "Controller" is .... and it is…
Phil
  • 13,875
  • 21
  • 81
  • 126
12
votes
0 answers

Is Pyramid's small user-base something I should be concerned about?

I'm new to web-application development, and I've just started building a (relatively large) webapp. Thus-far I've been using Django, however, I've just read about Pyramid, and I really like the sound of it: Its documentation reads well, it seems to…
Sky
  • 4,327
  • 4
  • 26
  • 40
12
votes
1 answer

Using beaker sessions for checking if user is authenticated in Pyramid

I'm creating a webapp using Pyramid with Beaker sessions. I would like to store user id in request.session['user_id'] and some other info after successful signing in and then use it for checking if user already signed in: if 'user_id' in…
12
votes
3 answers

Gzipping all HTTP traffic with Pyramid

I am creating a mobile service based on Pyramid framework. Because it's mobile everything to reduce bandwidth usage is plus. I am considering gzipping all the traffic, even dynamic HTML pages. What kind of hooks Pyramid framework provides for this?…
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
12
votes
1 answer

Pyramid logging

I have a pyramid application and I want the logs to got to stderr and stdout. stdout should be "INFO" level and below. stderr should be "WARN" and higher. How would I change my .ini file to do this? Currently I am logging like this, is this…
Conceited Code
  • 4,517
  • 3
  • 29
  • 32
12
votes
1 answer

What is the proper way to insert an object with a foreign key in SQLAlchemy?

When using SQLAlchemy, what is the ideal way to insert an object into a table with a column that is a foreign key and then commit it? Is there anything wrong with inserting objects with a foreign in the code below? def retrieve_objects(): …
Mark Tomlin
  • 513
  • 1
  • 7
  • 9
12
votes
3 answers

Speed comparisons between Chameleon and Jinja2

Has anyone here done any benchmarking of Chameleon versus Jinja2, in respect to performance? I'm more used to the Jinja syntax, since I come from Django, but as Pyramid suggests to use Chameleon, I'm thinking if it would be nice to give it a try -…
diogobaeder
  • 461
  • 5
  • 16