Forums

Get Error in running Bottle App

I have just made new bottle app but I got error when I test my bottle app. I fixed my .py file as below named app.py

import sqlite3

from bottle import route, run, template, debug, request

@route('/')

@route('/index.html')

@route('/tasks')

..............

application = default_app()

And here is my pythonanywhere_com_wsgi.py file.

from app import application

Please let me know why I got this issue. Thank you.

Look in your server and error logs. There will be a traceback that tells you what the problem is.

Thank you for your response. I checked error.log file. It says below.

NameError: name 'default_app' is not defined

2017-09-29 16:33:52,696: File "/var/www/xiaoming224_pythonanywhere_com_wsgi.py", line 22, in <module>

2017-09-29 16:33:52,696: from app import application

2017-09-29 16:33:52,696: File "/home/xiaoming224/mysite/app.py", line 86, in <module>

2017-09-29 16:33:52,696: application = default_app()

Please let me know why I got this issue. Thank you.

You're getting it because you haven't defined default_app. You probably need to import it in app.py.

Thank you for your response. I fixed this issue by adding follow code instead of application = default_app() code line.

"import bottle"

"application = bottle.default_app() "

But I have got other error in error.log file.

/usr/lib/python3.6/re.py:301: DeprecationWarning: Flags not at the start of the expression ((?m)[urbURB]?(?:''( (truncated)

2017-09-29 18:23:26,077: p = sre_compile.compile(pattern, flags)

2017-09-29 18:23:26,080: /usr/lib/python3.6/sre_parse.py:763: DeprecationWarning: Flags not at the start of the expression {{((?:((?m)[urbURB (truncated)

2017-09-29 18:23:26,080: p = _parse_sub(source, state, sub_verbose)

I use tpl files for example current_tasks.tpl in my project but get error at http://xiaoming224.pythonanywhere.com/.

The page says:

Error: 500 Internal Server Error

Sorry, the requested URL 'http://xiaoming224.pythonanywhere.com/' caused an error:

Template 'current_tasks' not found.

My account works fine. I changed working directory as same with source code. Thank you.