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
Filter by
Sorted by
Tagged with
5 votes
3 answers
2k views

Pyramid: Routing schemas and restraints

I have done my research and did some pattern matching trials but I still can not figure out how to: Make part of the route optional. e.g.: /required (/optional/{str}) Here the part in parentheses is ...
Phil's user avatar
  • 14.3k
5 votes
3 answers
3k views

Can Pyramid's Built-in Authentication/Authorization Implement Complex Security Schemes?

It seems like the security model fits very small projects, but that it is probably not feasible to write all possible registered users' hashed passwords in security.py. Do you know any examples of ...
nnythm's user avatar
  • 3,300
5 votes
4 answers
4k views

How do I write a logging middleware for pyramid/pylons 2?

I want to use either mongodb or redis to keep logs for users in pyramid/pylons, but cant find the doc on creating a middeware. How do I go about it?
Timmy's user avatar
  • 12.7k
5 votes
1 answer
2k views

Pyramid: multiple resource factories -- how to

I have a simple root resource factory: class Root: __acl__ = [ (Allow, Authenticated, 'edit') ] Now for some "special" routes, I need to create another resource factory config....
treecoder's user avatar
  • 44k
5 votes
2 answers
2k views

Is pyramid_who (repoze.who) the preferred way to do authentication for pyramid?

I am just starting to learn Pyramid Framework. Is pyramid_who (repoze.who) the preferred way to do authentication? What other options do I have?
sasker's user avatar
  • 2,241
5 votes
2 answers
4k views

Setup uWSGI as webserver with pyramid (no NGINX)

Most of the available tutorials show how to set up uWSGI with an upstream HTTP server (like NGINX). But uWSGI alone can act beautifully as router/proxy/load-balancer - refer this For my project, I ...
Dev Maha's user avatar
  • 1,133
5 votes
2 answers
594 views

pyramid: Inverse to add_notfound_view(append_slash=True)

In Pyramid, add_notfound_view(append_slash=True) will cause a request which does not match any view, but which would match a view if a trailing slash existed on the end, to be redirected to the ...
Charles Duffy's user avatar
5 votes
4 answers
1k views

How can I serve a WSGI Python app using Mongrel2?

This is an attempt to discover a canonical answer for something that seems to be hard to Google for right now. I am writing a web app in Pyramid, and I have the luxury of deciding what my server stack ...
Brighid McDonnell's user avatar
5 votes
1 answer
413 views

How do I find out the anchor in the URI in Pyramid?

Simply put, in Pyramid, when someone requests a page e.g.: /foo/#bar How do I find out what the anchor is? In this case, it would be bar. This seems like it should be trivial, but I'm not sure how ...
doppelgreener's user avatar
5 votes
1 answer
2k views

Pyramid and FormAlchemy admin interface

I have a pyramid project using the formalchemy admin interface. I added the basic ACL authentication and the pyramid_formalchemy plugin always denys even though I am authenticated. Any thoughts on ...
Conceited Code's user avatar
5 votes
1 answer
1k views

Pyramid view class inheritance with @view_defaults and @view_config decorators

I have written up a view class that has multiple @view_config's with predicates set for a single route. I then have a subclass that overwrites a couple of the sub-functions, which affects how the view ...
neRok's user avatar
  • 1,005
5 votes
3 answers
4k views

How to acceptance test captcha-protected web application functionality?

I would like to add a captcha, such as reCaptcha, to a certain functionality on my site. How could I adapt my acceptance tests? Is the only solution to disable the captcha's on the staging site? ...
Jasper van den Bosch's user avatar
5 votes
2 answers
8k views

How to use Websockets with Pyramid and socket.io?

I'm trying to create a simple WebSocket application using Pyramid and socket.io frameworks. Server-side code: from pyramid.response import Response from pyramid_socketio.io import SocketIOContext, ...
Ivan Gromov's user avatar
  • 4,285
5 votes
1 answer
3k views

How do I pass in the 'id' portion of the URL to a view_callable?

I've been playing around with Pyramid lately and, coming from a Pylons background, I've been focusing in URL routing rather than traversal. I've also been looking at using handlers to group together '...
dave's user avatar
  • 7,787
5 votes
2 answers
9k views

SQLAlchemy query raises unnecessary warning about sqlite and Decimal, how to specifically disable?

I'm using SQLAlchemy via pyramid accessing a simple sqlite database. As I was building my progressively more complex queries, I got this warning:- SAWarning: Dialect sqlite+pysqlite does not support ...
Ng Oon-Ee's user avatar
  • 1,223
5 votes
1 answer
6k views

'pyramid-debugtoolbar' distribution was not found and is required

I'm trying to debug my pyramid application via eclipse. I've followed the instructions in this link. When I try to run my app, I get the following error: pkg_resources.DistributionNotFound: The '...
sidx's user avatar
  • 640
5 votes
5 answers
821 views

Pyramid login and logout page return 404, the rest of the app works fine

I'm new to Pyramid and I'm following this guide: http://docs.pylonsproject.org/projects/pyramid/en/latest/tutorials/wiki2/authorization.html In Django, Views and URLs either worked or they crashed, ...
user1504605's user avatar
5 votes
2 answers
3k views

SQLAlchemy 0.7.8 raw string queries issue with params

I'm using SQLAlchemy with Pyramid application and I need to use 'format' paramstyle. For example: DBSession.execute('SELECT id FROM users WHERE email = %s;', email) This in theory should work, but I ...
Marek Szwalkiewicz's user avatar
5 votes
1 answer
1k views

Chameleon templates for javascript files?

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 ...
Graeme Stuart's user avatar
5 votes
2 answers
3k views

How to deploy a Pyramid app using pserve without installation?

I'm a beginner for Pyramid. I want to deploy Pyramid to my production server. I have a deploy script using Capistrano to do this. set :pid_path, "/var/lib/#{application}" set :log_path, "/var/log/#{...
Takahiro Fujiwara's user avatar
5 votes
6 answers
2k views

pyramid not work with angular $http post

$http({method: 'POST', url: 'http://localhost:5001/products', data: {token: $scope.product.token}}).success( function () { alert('success'); } ); In the pyramid side, request.POST ...
luthur's user avatar
  • 403
5 votes
2 answers
9k views

How can I generate a random url of a certain length every time a page is created?

In my python/pyramid app, I let users generate html pages which are stored in an amazon s3 bucket. I want each page to have a separate path like www.domain.com/2cxj4kl. I have figured out how to ...
BigBoy1337's user avatar
  • 4,835
5 votes
1 answer
2k views

Pyramid traversal is doing my head in

I am trying to get my head around Pyramid traversal with this very simple example. What I haven't quite grasped yet is where to "inject" an Article object from the db. As it is, /Article correctly ...
MFB's user avatar
  • 19.4k
5 votes
4 answers
5k views

How to get the real IP of a client in a pyramid server behind a nginx proxy

I have a Pyramid application which uses request.environ['REMOTE_ADDR'] in some places. The application is served by Python Paste on port 6543 and a nginx server listening on port 80 is forwarding ...
ascobol's user avatar
  • 7,614
5 votes
1 answer
3k views

How to get rid of library root mark in PyCharm

I've started working on a Pyramid application, which requires setup.py usage, but as soon as I built the app, my app folder was marked as library root. It is not convenient, because when I open a ...
stasdeep's user avatar
  • 2,928
5 votes
1 answer
2k views

Handling multiple models.py with alembic

Our web app is based on sqlalchemy in pyramid framework and we are looking to use alembic for managing database migrations. The web application consists of various packages that operate on one ...
Pankaj Lal's user avatar
5 votes
1 answer
3k views

DistributionNotFound when running pserve with docker-compose

I'm trying to run my simple Pyramid application with docker-compose, below are my docker files: Dockerfile: FROM python:2.7-onbuild RUN pip install --no-cache-dir -r requirements_dev.txt docker-...
matino's user avatar
  • 17.5k
5 votes
3 answers
2k views

Python Pyramid periodic task

My question is about how to perform a simple task in Pyramid Python framework? I have a table with users birthdays and I'd like to check daily if someone's birthday is coming, and if so, print a ...
annndrey's user avatar
  • 1,778
5 votes
3 answers
2k views

Pyramid invoking a sub request

I'm trying to implement a batch request method in pyramid. I see in the docs that it's done with subrequest = Request.blank('/relative/url') request.invoke_subrequest(subrequest) I'm just ...
Jeff's user avatar
  • 7,052
5 votes
1 answer
1k views

pyramid: constructe route_url without request object

I use yapps to generate a parser for a LaTex-ish language (for example to translate stuff like \begin{itemize} to the corresponding <ul>-Tags) within pyramid. One command (i.e. \ref{SOMEID}) ...
born's user avatar
  • 733
5 votes
2 answers
2k views

NLTK on a production web application

I'd like to incorporate a custom tagger into a web application (running on Pyramid) I'm developing. I have the tagger working fine on my local machine using NLTK, but I've read that NLTK is ...
abroekhof's user avatar
  • 796
5 votes
4 answers
2k views

How to use Pyramid i18n outside of views and templates?

Pyramid documentation shows us how to use i18n inside views (and templates as well). But how to does one use it outside of views and templates where we have no access to current request (for example, ...
Vitalii Ponomar's user avatar
5 votes
2 answers
3k views

pyramid: get application absolute url

Is there any way to get pyramid absolute application url in main() function? I want to add it into global settings, so it could be called every where(in templates and js files). In pyramid documents ...
Mehdi Seifi's user avatar
5 votes
2 answers
1k views

Turbomail Integration with Pyramid

I am in need of a method to send an email from a Pyramid application. I know of pyramid_mailer, but it seems to have a fairly limited message class. I don't understand if it's possible to write the ...
h0st1le's user avatar
  • 98
5 votes
5 answers
3k views

Import error in PyCharm even though importing from command line works

I am working on a pyramid project in PyCharm. I have all the packages installed and can import them from the command line. however, when i run my application run.py file This is the line that is ...
Fullmetal99012's user avatar
5 votes
1 answer
4k views

How to retrieve json data from a post request in Pyramid?

In Pyramid: class ProjectorViews(Layouts): def __init__(self, request): self.request = request @view_config(renderer="json", name="updates.json", request_method="POST") def updates_view(self): ...
Charles Gao's user avatar
5 votes
1 answer
3k views

SQLAlchemy: Knowing the field names and values of a model object?

I'm trying to keep to SOLID object oriented programming principles, stay DRY, etc, but my newness to Python/SQLAlchemy/Pyramid is making it very hard. I'm trying to take what I now know to be a ...
honestduane's user avatar
5 votes
1 answer
6k views

Filter on SQLAlchemy relationship

I am using Pyramid + SQLAlchemy and have the following set up from sqlalchemy import orm from __init__ import user_table from device import Device class User(object): def __repr__(self): ...
minovsky's user avatar
  • 857
5 votes
1 answer
135 views

Can a view configured for superclass be used if a view for a class was configured in Pyramid?

I am creating a simple pyramid-based CMS that uses traversal. There is a class called Collection, that has some subclasses like NewsCollection, GalleriesCollection etc. I need two kinds of views to ...
zefciu's user avatar
  • 2,017
5 votes
1 answer
4k views

Why am I getting an ImportError when I try to run Pyramid?

I'm trying to go through the "Single File Tasks" tutorial from the Pyramid documentation, but I'm running into a problem with actually running the single-file project. I am running Python 2.7 on ...
Eric's user avatar
  • 1,020
5 votes
1 answer
9k views

How i can use environment variables on .ini file in Pyramid?

For example, now I have this .ini file: [DEFAULT] db_user = user_test db_password = psw_test db_host = localhost db_name = db_test ... I want to do: export ENV_DB_USER=user_test export ENV_DB_PSW=...
Stefano's user avatar
  • 193
5 votes
1 answer
2k views

How to check for authenticated user in Pyramid templates?

I am using Pyramid 1.3b with Mako templating. I have a base template that displays some navigational components based on whether the user is logged-in or not. I am doing it this way: <%! ...
Mark's user avatar
  • 2,135
5 votes
3 answers
4k views

Pyramid (Python): Override default error view

Task: When an error occurs in one of my views I need to show a custom error view. The error type does not matter. I tried to override all exceptions by registring a view for all exceptions, like this:...
Taras Voinarovskyi's user avatar
5 votes
1 answer
1k views

SQLAlchemy and Pyramid, how to get resources out of context?

I'm having a problem wrapping my head around my Pyramid web application. I have it structured very much like the one described by Michael Merickel here, except I'm using pure traversal to find my ...
frank's user avatar
  • 1,332
5 votes
1 answer
2k views

inheriting config file settings in pyramid

Is a setup like this not possible? production.ini file: [app:main] use = egg:my_project ... various settings ... [server:main] ... development.ini file: [app:main] use = config:production.ini#...
lostdorje's user avatar
  • 6,330
5 votes
2 answers
3k views

Pyramid gunicorn and waitress

I'm trying to understand the behaviour of Pyramid regarding the [main:server] configuration and gunicorn. If I use pserve, it'll use the configuration of [main:server], for both waitress and gunicorn....
yami's user avatar
  • 71
5 votes
1 answer
2k views

Writing to same log file with Pyramid and rq

I am using Pyramid and rq and I would like to log rq worker jobs in the same file as my Pyramid application. My setup looks like this: development.ini # regular pyramid setup here... [loggers] ...
errata's user avatar
  • 5,863
5 votes
3 answers
862 views

Python Pyramid SQLAlchemy, MySQL server has gone away

I've ready many posts about this problem. My understanding is the Application has a setting which says how long to keep idle database connections before dropping them and creating new ones. MySQL ...
gimbel0893's user avatar
5 votes
1 answer
3k views

Unable to auto-generate migrations using alembic

My repository can be found here http://goo.gl/Q4WJXy (versions inside alembic folder)and I tried to use autogenerate migrations, alembic revision --autogenerate -m "some message" there is nothing ...
Mahesh Chandra Mukkamala's user avatar
5 votes
2 answers
3k views

How to render a Jinja2 macro from a view callable?

I have some macros defined that are called from several templates. For example, the Product page has a Review section that uses the macros defined in 'helpers/review.jinja2' to print each review. The ...
Marco Bruggmann's user avatar

1
3 4
5
6 7
45