i don't know how to write a "Hello World" on pythonanywhere.. always get error....
i don't know how to write a "Hello World" on pythonanywhere.. always get error....
What kind of error do you get? Do you mind if I take a look at your code?
code:
from bottle import *
@route('/') def i(): return "H1c7 World"
run(host='localhost', port=8080)
Don't use the run
function, our apps are served via WSGI.
If you use the wizard on the Web tab, and choose bottle.py, you'll get a basic bottle.py app which will work. YOu can then play with it from there...
If I change the default bottle app to a different file from the bottle_app.py file that is created, I get an import error on the new file. I still have
application = default_app()
in my new file and
from mynewmodule import application
in the ***_wsgi.py file. Am I missing something here? Log shows the same exception every time:
2013-08-17 23:52:27,683 :Traceback (most recent call last): 2013-08-17 23:52:27,684 :ImportError: cannot import name application
Sounds like a path issue. Have you added your new module to the path so that it is importable? Have a look at the original bottle app and you will see that it includes some code to do that.