WebFaction
Community site: login faq

I'm trying to set-up a very simple python web application using the Bottle framework. I followed the instructions in: https://community.webfaction.com/questions/12904/bottle-wsgi-application-support

The only difference is that I want to use python 3.4.

Here are the steps that I did:

create a new domain, new website, and a new application with the name 'api_snow' and type mod_wsgi 4.2.8/Python 3.4

In the terminal I ran the command pip3.4 install bottle

I tested running python3.4 on the commandline, and import bottle works.

I uploaded two files: /home/keskari/webapps/api_snow/htdocs/adapter.wsgi and /home/keskari/webapps/api_snow/htdocs/hello_bottle.py

adapter.wsgi looks like:

import sys, os, bottle
sys.path = ['/home/keskari/webapps/api_snow/htdocs/'] + sys.path
os.chdir(os.path.dirname(__file__))
import hello_bottle # This loads your application
application = bottle.default_app()

hello_bottle.py looks like:

from bottle import run, route, template

@route('/hello/<name>')
def index(name):
    return template('<b>Hello {{name}}</b>!', name=name)

if __name__ == '__main__':   
    run(host='localhost', port=8080)

last step: I went to /home/keskari/webapps/api_snow/apache2/conf/httpd.conf and added the line:

WSGIScriptAlias / /home/keskari/webapps/api_snow/htdocs/adapter.wsgi

Now when I run the web page, I get an Internal Server Error. And the error log shows:

ImportError: no module named 'bottle' in /home/keskari/webapps/api_snow/htdocs/adapter.wsgi

How do I instruct my application to find the bottle.py module?

asked 16 Sep '14, 04:55

jirik
121812
accept rate: 66%

edited 16 Sep '14, 04:57

Everything you've shown seems to indicate that the module should be available. Did you restart the mod_wsgi apache after updating the adapter.wsgi file?

If that's not the problem, can you tell us the actual URL where this issue appears?

(16 Sep '14, 09:16) ryans ♦♦

Restarting apache did the trick:

cd /home/keskari/webapps/api_snow/apache2/bin

./restart

(16 Sep '14, 17:03) jirik

I solved my problem by restarting the apache2 in my webapp. I run the following commands:

cd /home/keskari/webapps/api_snow/apache2/bin

./restart

permanent link

answered 16 Sep '14, 17:07

jirik
121812
accept rate: 66%

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

Question tags:

×56
×23
×9

question asked: 16 Sep '14, 04:55

question was seen: 4,350 times

last updated: 16 Sep '14, 17:07

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM