I am a beginner to using Pyramid, and somewhat to python in general. I am trying to deploy my first Pyramid app (I have it working locally) using wsgi. I have been following the instructions at https://docs.pylonsproject.org/projects/pyramid/1.0/tutorials/modwsgi/index.html but I can't seem to get it to work.

I have some questions, referring to the instructions in the link above:

• Referring to #4, where should the virtualenv be created? Say I have created an app using the webfaction control panel called "site_dev," located at /home/username/webapps/site_dev - where should it be installed relative to this?

• Referring to #9, I'm assuming the file to be editing is (assuming my app is called "site_dev") /home/username/webapps/site_dev/apache2/conf/httpd.conf. Is this correct?

• I'm still unclear on how, even if I get through all of these steps and get the app running, I will be able to see the app when I navigate to the url (domain) it is associated with. For example, if I navigate to dev.site.com, will I see the app if I follow these steps correctly?

I appreciate any help.

asked 07 Sep '11, 12:25

mikef's gravatar image

mikef
11
accept rate: 0%


Referring to #4, where should the virtualenv be created? Say I have created an app using the webfaction control panel called "site_dev," located at /home/username/webapps/site_dev - where should it be installed relative to this?

You can create your virtualenv anywhere you want within your home directory. What matters is that you configure Apache so that it can locate the Python modules within your virtualenv (ie, the "python-path" parameter in httpd.conf).

Referring to #9, I'm assuming the file to be editing is (assuming my app is called "site_dev") /home/username/webapps/site_dev/apache2/conf/httpd.conf. Is this correct?

That is correct.

I'm still unclear on how, even if I get through all of these steps and get the app running, I will be able to see the app when I navigate to the url (domain) it is associated with. For example, if I navigate to dev.site.com, will I see the app if I follow these steps correctly?

If you add your 'site_dev' app to a site in the control panel, and you have specified 'dev.site.com' as a subdomain for that site, then you should see the app when you navigate to dev.site.com.

link

answered 07 Sep '11, 14:31

seanf's gravatar image

seanf ♦♦
8.0k1726
accept rate: 39%

Thanks for your reply, this is helpful.

For the last question, I meant to ask, where should I put the source code for the project? In the tutorial it seems like a new app is created in the "env" folder. But wouldn't I have to put the code in the "/home/username/webapps/site_dev/httpdocs" folder of the wsgi app I created for it to show up when I navigate to the associated domain?

(07 Sep '11, 14:48) mikef mikef's gravatar image

You don't have to put your code in your httpdocs directory. You only need to ensure that your Python path is set correctly as I mentioned above, and that your WSGIScriptAlias is pointing to the correct location.

If all of this seems like too much work, then you might consider using the one-click Pyramid installer that we recently added to our control panel. You can then use that to serve your project.

(07 Sep '11, 19:26) seanf ♦♦ seanf's gravatar image

You can put it anywhere you want, however I would not recommend putting it into the "httpdocs" directory if the mod_wsgi application is attempting to serve this as static content (traditionally the "htdocs" directory or similar). Instead, do something like this:

cd "/home/username/webapps/site_dev/
mkdir env
cd env
(set up pyramid, and create the WSGI file)
(edit the ~/webapps/site_dev/apache2/conf/httpd.conf file)
(set up parameters and point: WSGIScriptAlias / /home/username/webapps/site_dev/env/pyramid.wsgi)

I have successfully set up a Pyramid application under mod_wsgi on webfaction, so if you run into any specific issues, just let us know.

(07 Sep '11, 19:26) ryans ♦♦ ryans's gravatar image

Thank you all for your help. For some reason I didn't even see the Pyramid installer, I think I will try that first, but It's great to have an understanding of how to do it manually.

(07 Sep '11, 19:54) mikef mikef's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×275
×51
×17

Asked: 07 Sep '11, 12:25

Seen: 1,809 times

Last updated: 07 Sep '11, 19:54

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited