Discussion:
[bottlepy] How to configure bottle behind apache and wscgi ?
Claudio
2016-07-05 14:13:44 UTC
Permalink
Hi all,
I'm trying to execute the script hello.py in this way:


After installing the wsgi_module I've configured Apache in this way:

<VirtualHost *:80>
ServerAdmin ***@mydomain.com
DocumentRoot /var/www/vhosts/csilib
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
WSGIDaemonProcess csilib user=www-data group=www-data processes=1 threads=5
WSGIScriptAlias /app /var/www/vhosts/csilib/app/app.wsgi
<Directory /var/www/vhosts/csilib/app >
WSGIProcessGroup csilib
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory></VirtualHost>

I've added the file /var/www/vhosts/csilib/app/app.wsgi

import os import sys
sys.path.append('/var/www/vhosts/csilib/app') import bottle import hello # Do NOT use bottle.run() with mod_wsgi
application = bottle.default_app()



and I've added the file /var/www/vhosts/csilib/app/hello/hello.py:


from bottle import route @route('/hello') def hello():
return "Hello World!"

In the same hello directory of hello.py I have the file __init__.py.

The problem is that if I call the url: http://127.0.0.1/app/hello I have
the error:

Sorry, the requested URL 'http://127.0.0.1/app/hello' caused an error: Not
found: '/hello'


What's wrong with my code?


Thank you

claudio
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Luis Garcia
2016-07-07 11:17:17 UTC
Permalink
Are you sure that "import hello" is working on app.wsgi?
It seems to me that app.wsgi is on "/var/www/vhosts/csilib/app" and to
import hello.py you need something like "from hello import hello" with that
python will look into the hello folder.
Post by Claudio
Hi all,
<VirtualHost *:80>
DocumentRoot /var/www/vhosts/csilib
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
WSGIDaemonProcess csilib user=www-data group=www-data processes=1 threads=5
WSGIScriptAlias /app /var/www/vhosts/csilib/app/app.wsgi
<Directory /var/www/vhosts/csilib/app >
WSGIProcessGroup csilib
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory></VirtualHost>
I've added the file /var/www/vhosts/csilib/app/app.wsgi
import os import sys
sys.path.append('/var/www/vhosts/csilib/app') import bottle import hello # Do NOT use bottle.run() with mod_wsgi
application = bottle.default_app()
return "Hello World!"
In the same hello directory of hello.py I have the file __init__.py.
The problem is that if I call the url: http://127.0.0.1/app/hello I have
Not found: '/hello'
What's wrong with my code?
Thank you
claudio
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Claudio
2016-07-27 12:26:58 UTC
Permalink
That was the problem, I thought that the "import hello" was working
wherease it was not working.
Thank you

Claudio
Post by Luis Garcia
Are you sure that "import hello" is working on app.wsgi?
It seems to me that app.wsgi is on "/var/www/vhosts/csilib/app" and to
import hello.py you need something like "from hello import hello" with that
python will look into the hello folder.
Post by Claudio
Hi all,
<VirtualHost *:80>
DocumentRoot /var/www/vhosts/csilib
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
WSGIDaemonProcess csilib user=www-data group=www-data processes=1 threads=5
WSGIScriptAlias /app /var/www/vhosts/csilib/app/app.wsgi
<Directory /var/www/vhosts/csilib/app >
WSGIProcessGroup csilib
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory></VirtualHost>
I've added the file /var/www/vhosts/csilib/app/app.wsgi
import os import sys
sys.path.append('/var/www/vhosts/csilib/app') import bottle import hello # Do NOT use bottle.run() with mod_wsgi
application = bottle.default_app()
return "Hello World!"
In the same hello directory of hello.py I have the file __init__.py.
The problem is that if I call the url: http://127.0.0.1/app/hello I have
Not found: '/hello'
What's wrong with my code?
Thank you
claudio
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...