pyramid & apache configuration problem

71 views
Skip to first unread message

Edward

unread,
Feb 29, 2012, 8:56:47 AM2/29/12
to pylons-...@googlegroups.com
I have been following the instruction in this page.

My environment.
Server: Ubuntu 11.04
Python 2.7.1
Installed mod_wsgi with the command sudo apt-get install libapache2-mod-wsgi

cd /home/hmkcreative

virtualenv --no-site-packages envy

./bin/pcreate -s starter myapp

cd myapp

../bin/python setup.py install


made pyramid.wsgi file under envp

with the following


from pyramid.paster import get_app

application = get_app(

  '/home/hmkcreative/envp/myapp/production.ini', 'main')


Changed the permission on pyramid.wsgi file.

I copied the config file

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite 

sudo a2dissite default && sudo a2ensite mysite

sudo /etc/init.d/apache2 restart

Now the problem.

I get 500 internal server error when I access http://<ip address>/myapp


Right now, I don't know how to fix it or where to turn to.

The following is more detailed information.

If you can help me, I would really appreciate it.

Thank you for your input.


                       Edward


Here's the error log

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5] mod_wsgi (pid=1823, process='pyramid', application=''): Failed to parse WSGI script file '/home/hmkcreative/envp/pyramid.wsgi'.

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5] mod_wsgi (pid=1823): Exception occurred processing WSGI script '/home/hmkcreative/envp/pyramid.wsgi'.

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5]   File "/home/hmkcreative/envp/pyramid.wsgi", line 1

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5]     fromm pyramid.paster import get_app

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5]                 ^

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5] SyntaxError: invalid syntax

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5] File does not exist: /home/hiro/envp/favicon.ico


The following is my mysite config file


<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /home/hiro/envp
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

# Use only 1 Python sub-interpreter.  Multiple sub-interpreters
# play badly with C extensions.
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=hiro group=staff threads=4 \
   python-path=/home/hiro/envp/lib/python2.7/site-packages
WSGIScriptAlias /myapp /home/hiro/envp/pyramid.wsgi

<Directory /home/hiro/envp>
  WSGIProcessGroup pyramid
  Order allow,deny
  Allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

Ronan Amicel

unread,
Feb 29, 2012, 9:06:46 AM2/29/12
to pylons-...@googlegroups.com
Here is your problem (typo in pyramid.wsgi):

Le 29 févr. 2012 à 14:56, Edward <hi...@hmkcreative.com> a écrit :

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5]   File "/home/hmkcreative/envp/pyramid.wsgi", line 1

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5]     fromm pyramid.paster import get_app

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5]                 ^

[Wed Feb 29 22:36:37 2012] [error] [client 192.168.0.5] SyntaxError: invalid syntax


-- 
Ronan Amicel

HIRONORI KAWANO

unread,
Feb 29, 2012, 4:23:33 PM2/29/12
to pylons-...@googlegroups.com
Thank you Ronan.
Now it works!

Edward

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.

Reply all
Reply to author
Forward
0 new messages