bard
bard

Reputation: 3072

How to deploy a Pyramid app to DotCloud?

I have a Pyramid webapp with a Postgres database, and I'm using git for version control.

This is how my files are structured:

myapp/
  |----dotcloud.yml
  |----env/ # virtualenv
  |----MyProject/
        |
        |----production.ini
        |----requirements.txt
        |----myapp.sql
        |----myapp.psql
        |----wsgi.py
        |----myproject
              |
              |----scripts/
              |----static/
              |----templates/
              |----__init__.py
              |----views.py
              |----models.py

This is my dotcloud.yml:

www:
  type: python
  config:
    python_version: v2.7
  approot: home/home/myapp

db:
  type: postgresql

This is my wsgi.py:

from pyramid.paster import get_app, setup_logging
ini.ath = '.../myproject/production.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')

This is my (simplified) __init__.py:

def main(global_config, **settings):
  engine = engine_from_config(settings, 'sqlalchemy.')
  DBSession.configure(bind=engine)
  config = Configurator(...)
  config.add_static_view('static', 'static', cache_max_age=3600)
  config.add_route('index', '/')
  # other routes...
  config.scan()
  return config.make_wsgi_app()

I've read the official documentation and the third-party documentation to get to this point but there must be something I'm not doing right. It's my first time deploying a webapp, and running my app locally still works.

In MyProject/ (where the dotcloud.yml file resides) I did dotcloud create mydomainname, dotcloud connect mydomainname and then dotcloud push. But I'm getting an internal server error. What am I doing wrong?

Also, the documentation says that if I'm using git, I must state that explicitly when I use dotcloud create or dotcloud connect, but what is the exact command?

EDIT: Before moving to DotCloud, I tried to use DigitalOcean, and had some problems when using pip to install the dependencies in requirements.txt. I had to do a git clone separately on the CLI so that I could enter my username and password, and I also had to install psycopg2 manually. Could this be one of the problems here too? If so, how can I fix it?

Upvotes: 0

Views: 95

Answers (1)

Andy
Andy

Reputation: 38337

There are several things you should try changing. First, do not push your virtualenv directory (env). The dotCloud builder will create another virtualenv based on your requirements.txt. One way to avoid pushing your env directory would be to move dotcloud.yml to MyProject. You seem to think that is where it is ("In MyProject/ (where the dotcloud.yml file resides)" ) but that is not what your file tree says.

Then, do the dotcloud connect or dotcloud create in MyProject, as you stated.

You should remove the approot line from your dotcloud.yml. Allow approot to go to its default, the current directory.

Upvotes: 0

Related Questions