How to host a Pyramid app?

Hi there. I'm desperately trying to deploy a simple Pyramid App, which I can locally serve (using Pyramid 1.4b1) running

../bin/pserve production.ini

using this the (temporary)

import os
import sys

path = '/home/arialdomartini/Dropbox/domidoo'
if path not in sys.path:

from pyramid.paster import get_app
ini_path = '/home/arialdomartini/Dropbox/domidoo/production.ini'
application = get_app(ini_path, 'main')

The application is the scaffold one create by

bin/pcreate -s starter domidoo

that is, a scaffolded HelloWorld app.

I'm receiving this error

2012-12-08 22:57:56,258 :Traceback (most recent call last):
2012-12-08 22:57:56,259 :pkg_resources.DistributionNotFound: waitress

Unfortunately I'm able to find any documentations nor tutorials which can help.

Do you have any hint or link to suggest me? Cheers!

First: have you clicked on 'reload web app'? Second: does this help -

Hi rcs1000. Thanks for the reply. Yes, I clicked on "Reload Web App" using the "pythonanywhere bookmarklet". And, yes, I read the thread you linked. Unfortunately, none of those 2 hints solved my problem.

Meanwhile, I found this solution, which I'm posting for the benefit of other Pyramid's developers.

Open a bash console

Click Dashboard, then Bash

Create a Virtual Environment

virtualenv env

Install Pyramid

cd env
./bin/pip install pyramid

Pay attention: use ./bin/pip rather than pip, or pyramid won't be installed in the virtualenv

Create a project

./bin/pcreate -s starter myproject

Configure to use the virtualenv

Edit the current using

emacs /var/www/

or clicking Dashboard -> Web -> /var/www/

Then, use this script

activate_this = "/home/YOUR_USERNAME/env/bin/"

import os
import sys

path = '/home/YOUR_USERNAME/env/myproject'

if path not in sys.path:

from pyramid.paster import get_app
ini_path = path + '/production.ini'
application = get_app(ini_path, 'main')

The first 2 lines tells pythonanywhere to use the new virtualenv rather than the system

Restart the web app

Restart the web app clicking on "Reload web app"

Thanks for details. As someone who's only ever used Django, what are the key advantages of Pyramid?

I'm not an expert, so please, forgive me in the case I'm wrong.

As far as I know, Django is much more a full-stack framework than a pluggable environment, like Pyramid.

The strenght of Django comes from the rich set of built-ins, such as the ORM and the configuration system, which allow to develop a web application very quickly. On the other hand, I think that, compared to Pyramid's phylosophy, Django forces the developer to program in Django's style. I mean: should Django's built-ins not suit the specific needs of your application, you might discover that customizing Django is a bit more hard than customizing Pyramid.

In fact, Pyramid's strength is its exceptionally high flexibility: while Django is a sort of predefined set of tools (very well) mixed together, Pyramid is a huge system where almost everything can be replaced. Obviously, almost everything is a bit more hard, since there's no predefined easy way to develop in a Pyramid-style.

For example: using Django, try to replace the ORM with a different one; or try to use a NoSQL database, or a different URL mapper and router.

You might say that Pyramid is made exactly for this: you could think of Pyramid as a huge and brilliant wrapper for other components. Just choose the ones you like, and build your app.

I may be wrong, but I've got the feeling that Django is well suited for simpler, more standard web application, while Pyramid is much more hard for simple applications, but it might reveal more useful for more enterprise situations.

But, I stress: don't take me too literally, I'm not an expert.

You may find this page useful.