Forums

Something went wrong :-( when loading a new web app on python anywhere

I uploaded my Django app on python anywhere but it is not loading. Getting this on screen.

Something went wrong :-(

This website is hosted by PythonAnywhere, an online hosting environment. Something went wrong while trying to load it; please try again later.

If this is your PythonAnywhere-hosted site, there may be a bug in your code. Check your site's server and error logs for any messages — you can view them from the Web tab inside PythonAnywhere.

You'll find a series of tips on how to debug problems, and solutions to common issues on our Help pages

If you get completely stuck, then drop us a line at support@pythonanywhere.com, in the forums, or using the "Send feedback" link on the site, quoting the error code below.

Error code: Unhandled Exception

This is what my wsgi file looks like.

activate_this_path = '/home/amritha/.virtualenvs/costtool/bin/activate_this.py' with open(activate_this_path) as f: code = compile(f.read(), activate_this_path, 'exec') exec(code, dict(file=activate_this_path))

import os import sys

path = '/home/amritha/costtool' if path not in sys.path: sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'costtool.settings'

import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()

Can somebody help me out?

Hi amritha,

I would encourage you to take a look at the error log as shown here.

If you could look at the error message is there, you might be able to find your problem. Otherwise maybe you could post your error log here and we could take a look at it together?

Hi Conrad, First few lines of my error log 2

014-12-03 16:31:01,514 :Traceback (most recent call last):
2014-12-03 16:31:01,514 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2014-12-03 16:31:01,515 :    self.error_log_file.logger.exception("Error running WSGI application")
2014-12-03 16:31:01,515 :  File "/usr/lib/python3.4/logging/__init__.py", line 1296, in exception
2014-12-03 16:31:01,531 :    self.error(msg, *args, **kwargs)
2014-12-03 16:31:01,532 :  File "/usr/lib/python3.4/logging/__init__.py", line 1289, in error
2014-12-03 16:31:01,532 :    self._log(ERROR, msg, args, **kwargs)
2014-12-03 16:31:01,532 :  File "/usr/lib/python3.4/logging/__init__.py", line 1395, in _log
2014-12-03 16:31:01,533 :    self.handle(record)
2014-12-03 16:31:01,533 :  File "/usr/lib/python3.4/logging/__init__.py", line 1404, in handle
2014-12-03 16:31:01,533 :    if (not self.disabled) and self.filter(record):
2014-12-03 16:31:01,533 :  File "/usr/lib/python3.4/logging/__init__.py", line 692, in filter
2014-12-03 16:31:01,534 :    for f in self.filters:
2014-12-03 16:31:01,534 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2014-12-03 16:31:01,534 :    app_iterator = self.app(environ, start_response)
2014-12-03 16:31:01,534 :  File "/bin/user_wsgi_wrapper.py", line 136, in import_error_application
2014-12-03 16:31:01,534 :    raise e
2014-12-03 16:31:01,534 :  File "/bin/user_wsgi_wrapper.py", line 145, in <module>
2014-12-03 16:31:01,535 :    application = load_wsgi_application()
2014-12-03 16:31:01,535 :  File "/bin/user_wsgi_wrapper.py", line 141, in load_wsgi_application
2014-12-03 16:31:01,535 :    return __import__(os.environ['WSGI_MODULE'], globals(), locals(), ['application']).application
2014-12-03 16:31:01,535 :  File "/var/www/amritha_pythonanywhere_com_wsgi.py", line 18, in <module>
2014-12-03 16:31:01,537 :    with open(activate_this_path) as f:
2014-12-03 16:31:01,538 :FileNotFoundError: [Errno 2] No such file or directory: '/home/amritha/costtool/bin/activate_this.py'

This is what I have in my wsgi.py file. As you can see, the activate_this.py file is in a different location from what is given in the error log.

activate_this_path = '/home/amritha/.virtualenvs/costtool/bin/activate_this.py'
with open(activate_this_path) as f:
    code = compile(f.read(), activate_this_path, 'exec')
exec(code, dict(__file__=activate_this_path))

#DJANGO

import os
import sys
#
## assuming your django settings file is at '/home/amritha/mysite/settings.py'
path = '/home/amritha/costtool'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'costtool.settings'
#
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

[edit by admin: formatting]

To clarify, the logs you were looking at are chronological, so the most recent stuff is on the bottom. You were looking at errors from a day ago- which I think you have fixed already.

Hello , I am having the same problem while loading my site first time

By the same problem do you mean that you have "No such file or directory: '/home/amritha/costtool/bin/activate_this.py'" in your web app error log?